viết chương trình tính tổng n số tự nhiên nhập từ bàn phím
Giải thích
Lời giải:
program tinhtong;
uses crt;
var i,s,n:integer;
a:array [1.100] of integer;
begin
clrscr;
write('So thu n la: 3; readln(n);
s:=0
for i:=1 to n do begin
write(Nhap so thu ',i); readln(a[i]);
s=s+a[i]; end;
writeln('Tong cac so do la:', s);
readln
end.