1. S = 2 + 4 + 6 +…+ n 2. S = 3 + 5 + 7 +…+ n

1. S = 2 + 4 + 6 +…+ n
2. S = 3 + 5 + 7 +…+ n

0 bình luận về “1. S = 2 + 4 + 6 +…+ n 2. S = 3 + 5 + 7 +…+ n”

  1. 1/

    Program BTH;
    uses crt;
    var s:real;
    i,n:longint;
    Begin
            clrscr;
            write(‘Nhap n: ‘);readln(n);
            For i:=2 to n do
            Begin
                    If i mod 2=1 then s:=s+1/i;
            end;
            writeln(‘Tong day so tren la: ‘,s:4:2);
            readln;
    end.

    2/

    Program BTH;
    uses crt;
    var s:real;
    i,n:longint;
    Begin
            clrscr;
            write(‘Nhap n: ‘);readln(n);
            For i:=2 to n do
            Begin
                    If i mod 2=0 then s:=s+1/i;
            end;
            writeln(‘Tong day so tren la: ‘,s:4:2);
            readln;
    end.

    Bình luận

Viết một bình luận