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
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 mod 2<>0) then t:=t+a;
until a=0;
writeln(t);
readln;
end.
uses crt;
var n,i,t,s:integer;
begin
clrscr;
repeat
readln(n);
until n<>0;
t:=0;
for i:=1 to n do if i mod 2=0 then t:=t+i;
writeln(t);
s:=1;
for i:=1 to n do
if i mod 2=1 then s:=s*i;
writeln(s);
readln;
end.
program C1;
uses crt;
Var A:array[1..100] of Integer ;
Tc, Tl : Integer ;
n, i: Btybe ;
begin
clrscr ;
Write( ' nhap n: ' ) ; Readln(n) ;
For i:=1 to n do
begin
Write ( ' A[ ' ,i, '] = ' ) ; Readln (A[i]) ;
end ;
Tc: = 0 ; Tl: = 0 ;
For i: = 1 to n do
If A[i] mod 2=0 then Tc:=Tc+A[i]
else Tl:= Tl + A[i] ;
Writeln ( ' Tong so chan : ' ; Tc) ;
Writeln ( ' Tong so le : ' , Tl ) ;
readln ;
end.
Bài 1:
uses crt;
var a:array[1..100]of integer;
i,n:integer;
begin
clrscr;
write('Nhap n='); readln(n);
for i:=1 to n do
begin
write('A[',i,']='); readln(a[i]);
end;
for i:=1 to n do
if a[i] mod 2<>0 then write(a[i]:4);
readln;
end.
Bài 2:
uses crt;
var a:array[1..100]of integer;
i,n:integer;
begin
clrscr;
write('Nhap n='); readln(n);
for i:=1 to n do
begin
write('A[',i,']='); readln(a[i]);
end;
for i:=1 to n do
if a[i] mod 2=0 then write(a[i]:4);
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.