Чем благодарен будешь?
1.
Код:
1 2 3 4 5 6 7 8 9 10 11 12 13 14 | program Task1;
{$APPTYPE CONSOLE}
var
N, I, S : Integer ;
begin
Write ( 'Введите N (N>0):' ); ReadLn(N);
S := 0 ;
For I := 1 to N Do
S := S + sqr(N+N+ 1 );
WriteLn ( 'S = ' ,S);
Write ( 'Press [Enter] to close...' ); ReadLn;
end .
|
2.
Код:
1 2 3 4 5 6 7 8 9 10 11 12 13 14 15 16 17 18 19 20 21 22 | program Task2;
{$APPTYPE CONSOLE}
var
N, S, C : Integer ;
begin
S := 0 ;
C := 0 ;
WriteLn ( 'Введите числа, 0 - окончание ввода:' );
repeat
ReadLn(N);
If ((N mod 100 ) div 10 ) = 4 Then
Begin
S := S + N;
Inc(C);
End ;
until N = 0 ;
WriteLn ( 'Avg = ' ,S/C);
Write ( 'Press [Enter] to close...' ); ReadLn;
end .
|
Последний раз редактировалось lmikle, 26.10.2016 в 22:36.
|