Hãy nhập câu hỏi của bạn vào đây, nếu là tài khoản VIP, bạn sẽ được ưu tiên trả lời.
uses crt;
var a,t:integer;
begin
clrscr;
t:=0;
repeat
readln(a);
if (a mod 2<>0) then t:=t+a;
until a=0;
writeln(t);
readln;
end.
count_even = 0
count_odd = 0
while True:
num = int(input("Nhap so nguyen: ")) //0 de kthuc
if num == 0:
break
if num % 2 == 0:
count_even += 1
else:
count_odd += 1
print("Số lẻ:", count_odd)
print("Số chẵn:", count_even)
uses crt;
var n,i,t1,t2:integer;
begin
clrscr;
t1:=0;
t2:=0;
repeat
readln(n);
if n mod 2=0 then t1:=t1+n
else t2:=t2+n;
until n=0;
writeln(t1,' ',t2);
readln;
end.
uses crt;
var a,t:integer;
begin
clrscr;
t:=0;
repeat
write('Nhap a='); readln(a);
t:=t+a;
until a=0;
writeln(t);
readln;
end.
uses crt;
var a,t:integer;
begin
clrscr;
t=0;
repeat
readln(a);
if (a>0) then t:=t+a;
until (a mod 2=0);
writeln(t);
readln;
end.
uses crt;
var x,t,i:integer;
begin
clrscr;
t:=0;
repeat
readln(x);
t:=t+x;
until x=0;
write(t);
readln;
end.
refer
program dem;
uses crt;
var n,i,j,S: integer;
a:array[1..100] of integer;
begin
i:=0;
S:=0;
while(readln(n)) do
begin
if(n:=0) then break;
i:=i+1;
a[i]:=n;
end;
for j:=1 to i do
begin
if(a[j] mod 2 <> 0) then S:=S+a[j];
end;
write(‘Tong cua cac so le la: ‘,S);
readln;