tong so nguyen to
unknown
pascal
4 years ago
957 B
6
Indexable
{ Online Pascal Compiler. Code, Compile, Run and Debug Pascal program online. Write your code in this editor and press "Run" button to execute it. } program tong_so_nguyen_to; uses crt; var a: array[1..10] of integer; i, x, n, dem, s: integer; begin writeln ('Nhap so phan tu mang: '); readln(n); { 5 } writeln ('Nhap cac phan tu cua mang'); for i:=1 to n do begin write('a[',i,']='); readln(a[i]); end { 10 20 30 40 50 } dem:=0; s:=0; while i<>n do begin for i:=1 to a[1] do if a[1] mod i = 0 then dem := dem + 1; if dem = 2 then s:=s+a[1]; a[1]:=a[2]; end for i:=1 to a[x] do if a[x] mod i = 0 then dem := dem + 1; if dem = 2 then s:=s+a[x]; readln; end.
Editor is loading...