Cls input n dim a(n) s=0 for i=1 to n input a(i) next i for i=1 to n if a(i)> 0 then s=s+1 next i if s> 0 then p=1: t=0 dim b(s) for i=1 to s for j=p to n t=t+1 if a(j)> 0 then b(i)=a(j) goto 1 next j 1: p=t next i for i=1 to s for j=1 to s if b(i)< b(j) then swap b(i),b(j) next j next i for i=1 to s print b(i); next i end if
Спасибо
Ответ дал: Гость
program summa;
var s, a, b, c : word;
begin
write('введите a - > '); readln(a);
write('введите b - > '); readln(b);
write('введите с - > '); readln(c);
s: =a+b+c;
write(' сумма равна ',s);
readln
end.
Ответ дал: Гость
program rrr; uses crt; const n=9; type massiv=array[1..n]of real; var a: massiv; max,sr: integer; procedure vvod(var x: massiv); var i: integer; beginwriteln('wwedite massiv'); for i: =1 to n doreadln(x[i]); end; procedure vivod(x: massiv); var i: integer; beginfor i: =1 to n dowrite(x[i]: 6: 2,' '); end; procedure sred_ar_i_max(x: massiv,var sr,max: real); var sum: real; i: integer; begins: =0; for i: =1 to n doif x[i]> 0 then s: =s+x[i]; end; sr: =s/n; for i: =1 to n doif (x[i]> 0) and max< x[i] then max: =x[i]; end; vvod(a); clrscr; vivod(a); sred_ar_i_max(a,sr,max); writeln('max=',max: 6: 2,'srednee arifmet=',sr: 6: 2); readln; end.
Популярные вопросы