madinakz1
14.03.2022 23:33

Написать программу, которая выводила на экран числа от 1 до 50 в строчку я реально не догоняю
В формате
CLS
FOR
PRINT
NEXT
Буду очень благодарна

Нажмите на рекламу ниже и сразу увидите ответ
Популярные вопросы:
Ответ:
daniilkornev05
11.04.2022 13:09
1. "Школьное" решение

// PascalABC.NET 3.0, сборка 1073
const
  sb='bcdfgjklmnpqrstvwxz';
  s='Computer programming is a process of computer programs creation';
var
  i,n:integer;
  s1,sn,t:string;
begin
  i:=1;
  while s[i]<>' ' do Inc(i);
  s1:=Copy(s,1,i-1);
  n:=Length(s); i:=n;
  while s[i]<>' ' do Dec(i);
  sn:=Copy(s,i+1,n-i);
  t:='';
  for i:=1 to Length(s1) do
    if Pos(s1[i],sb)>0 then t:=t+s1[i];
  s1:=t;
  t:='';
  for i:=1 to Length(sn) do
    if Pos(sn[i],sb)>0 then t:=t+sn[i];
  sn:=t;
  t:='';
  for i:=1 to Length(s1) do
    if Pos(s1[i],sn)>0 then
      if Pos(s1[i],t)=0 then t:=t+s1[i];
  for i:=1 to Length(t) do Write(t[i],' ');
  Writeln
end.
 
Тестовый прогон:
t r

2. "Нормальное" решение

// PascalABC.NET 3.0, сборка 1073
const
  sb='bcdfgjklmnpqrstvwxz';
  s='Computer programming is a process of computer programs creation';
begin
  var a:=s.ToWords(' ');
  a[0].Intersect(a[a.Length-1]).Where(x->Pos(x,sb)>0).Println(',')
end.

Тестовый прогон:
t,r
0,0(0 оценок)
Ответ:
Melentii
25.09.2021 06:18

Часть 1

1.

a, b, c, d = int(input()), int(input()), int(input()), int(input())

s = (a + b + c + d)/4

print(s)

2.

x, y = int(input()), int(input())

t = x

x = y

y = t

print(x, y, sep = "\n")

4.

from math import pi

L, D = float(input()), float(input())

R = (L - D) / (2 * pi)

print(R)

5.

from math import pi

R1, R2 = float(input()), float(input())

r = R1**2 - R2**2

S = pi * r

print(S)

6.

x, y = int(input()), int(input())

S = (2*x - y)*(x - y)

print(S)

Часть 2

1.

x, y = float(input()), float(input())

x, y = y, x

print(x, y)

2.

если нужно найти y = x * 5:

x = int(input())

y = x * 5

print(y)

если нужно найти y = x^{2}:

x = int(input())

y = x ** 5

print(y)

3.

x = int(input())

y = 1 - 2*x + 3*x**2 - 4*x**3

print(y)

4.

x1, y1, x2, y2 = float(input()), float(input()), float(input()), float(input())

from math import sqrt

S = sqrt((x1 - x2)**2 + (y1 - y2)**2)

print(S)

0,0(0 оценок)
Полный доступ
Позволит учиться лучше и быстрее. Неограниченный доступ к базе и ответам от экспертов и ai-bota Оформи подписку
logo
Начни делиться знаниями
Вход Регистрация
Что ты хочешь узнать?
Спроси ai-бота