Begin typing your search above and press return to search. Press Esc to cancel.

Contoh Program Pascal Perulangan For to do



CONTOH PERULANGAN FOR TO DO

Program DeretDivergen;
Uses Crt;
Var
   q,w,e,batas : integer;

Begin
Clrscr;
     write      ('Masukkan batas akhir: ');
     readln     (Batas);
     q := 1;
     e := 1;
     w := 1;
     if (Batas>0) then
     begin
          for e := e + 1 to batas do
          begin
               write(' + ',q);
               q := q + 2;
               w := w + e;

          end;
     end
                 else
     begin
          writeln('Masukkan data anda salah');
     end;
     write(' = ',w);
     readln();
end.


SEMOGA BERMANFAAT

TERIMAH KASIH TELAH MENGUNJUNGI APOTIK-ILMU

    No comments:

    Post a Comment