Program HOC24;
var i,n: integer;
a: array[1..10000] of integer;
t: longint;
begin
write('Nhap N: '); readln(n);
for i:=1 to n do
begin
write('A[',i,']='); readln(a[i]);
end;
t:=0;
for i:=1 to n do if (a[i] mod 3=0) and (a[i] mod 5=0) then t:=t+a[i];
write('Tong la: ',t);
readln
end.
A = int(input('N = '))
if (A >= 0) and (A <= 10**3):
i = 0
tong = 0
print (i)
while (i <= 10**3):
i += 1
if (i%3==0) and (i%5==0):
if (i <= A):
tong += i
print (i)
print (f'Tổng: {tong}')
A = int(input('N = '))
if (A >= 0) and (A <= 10**3):
i, tong = 0, 0
print (i)
while (i <= 10**3) and (i <= A):
i += 1
if (i%3==0) and (i%5==0):
tong += i
print (i)
print (f'Tổng: {tong}')
A = int(input('N = '))
if (A >= 0) and (A <= 10**3):
i, tong = 0, 0
print (i)
while (i <= 10**3) and (i <= A):
i += 1
if (i%3==0) and (i%5==0):
tong += i
print (i)
print (f'Tổng: {tong}')
A = int(input('N = '))
if (A >= 0) and (A <= 10**3):
i, tong = 0, 0
print (i)
while (i <= 10**3) and (i <= A):
i += 1
if (i%3==0) and (i%5==0):
tong += i
print (i)
print (f'Tổng: {tong}')
A = int(input('N = '))
if (A >= 0) and (A <= 10**3):
i, tong = 0, 0
print (i)
while (i <= 10**3) and (i <= A):
i += 1
if (i%3==0) and (i%5==0):
tong += i
print (i)
print (f'Tổng: {tong}')