1)program fagasg; var x1,y1,r: real; begin Writeln('Введите х1'); readln(x1); Writeln('Введите у1'); readln(y1); r:=sqrt(x1*x1+y1*y1); Writeln('Расстояние от х1 до у1=',r); end. 2)Program fsgasghfd; var c,s: real; a,b: integer; begin Writeln('Введите первое целое число'); readln(a); Writeln('Введите второе целое число'); readln(b); Writeln('Введите дробное число'); readln(c); If ((a>0) and (b>0) and (c>0)) or ((a<0) and (b<0) and (c<0)) then s:=a+b+c else writeln('Знаки разные'); If ((a>0) and (b>0) and (c>0)) or ((a<0) and (b<0) and (c<0)) then Writeln('Сумма чисел:',s); end. 3)Program wrqrwqr; var A: Array[1..100] of integer; B: Array[1..100] of integer; C: Array[1..100] of integer; s,i,h,g: integer; begin h:=0; g:=0; Writeln('введите размерность массива'); readln(s); Writeln('Вводится первый массив'); For i:=1 to s do begin Writeln('Введите элемент массива №',i); readln(A[i]); end; Writeln('Вводится второй массив'); For i:=1 to s do begin Writeln('Введите элемент массива №',i); readln(B[i]); end; For i:=1 to s do begin If A[i]>B[i] then C[i]:=A[i] else C[i]:=B[i]; If C[i] mod 2=1 then h:=h+1; If C[i] mod 2=0 then g:=g+1; end; Writeln('Количество нечётных элементов в массиве:',h); Writeln('Количество чётных элементов в массиве:',g); end.
Вот тебе простой вариант ришение задачи (коментар=пояснение)
PascalВыделить код
1 2 3 4 5 6 7 8 9 10 11 12 13 14 15 16 program prg; uses crt; var rez,chislo,min,max:integer; begin Write('Enter number = ');readln(chislo); //zanosim 1 chislo max:=chislo; //v max ta min min:=chislo; //chtobu potom mu soukb sravnivat s drugimi chislamu while (chislo<>0) do //zapuskaem zikl poka mu ne napishem 0 begin if (chislo>max)then max:=chislo; //sravnivaem s max if (chislo<min) then min:=chislo; //sravnivaem s min readln(chislo); //snova pihem chislo end; rez:=(max-min); //nahodim raznizy writeln('max(',max,') - min(',min,') = ',rez); //otvet end.
0,0(0 оценок)
Полный доступ
Позволит учиться лучше и быстрее. Неограниченный доступ к базе и ответам от экспертов и ai-bota
Оформи подписку