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 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 x,t,i:integer;
begin
clrscr;
t:=0;
repeat
readln(x);
t:=t+x;
until x=0;
write(t);
readln;
end.
uses crt;
var n,t1:integer;
s:real;
begin
clrscr;
t1:=0;
s:=1;
repeat
readln\(\left(n\right)\);
if n mod 2=0 then t1:=t1+n
else s:=s*n;
until n=0;
writeln\(\left(t1\right)\);
writeln\(\left(s:4:2\right)\);
readln;
end.
Câu 1:
Program HOC24;
var i,p: integer;
t: longint;
begin
write('Nhap P: '); readln(p);
t:=0;
for i:=1 to p do if i mod 2<>0 then t:=t+i;
write('Tong cac so le la: ',t);
readln
end.
1:
uses crt;
var t,x,i,n:integer;
begin
clrscr;
t:=0;
n:=10;
for i:=1 to n do
begin
readln(x);
t:=t+x;
end;
write(t);
readln;
end.
2:
uses crt;
var dem,x,i,n:integer;
begin
clrscr;
dem:=0;
n:=10;
for i:=1 to n do
begin
readln(x);
if x mod 2=0 then inc(dem);
end;
write(dem);
readln;
end.
3
program Cacsole;
uses crt;
var M, N, i: integer;
begin
clrscr;
write ('Nhap M= '); readln(M);
write ('Nhap N= '); readln(N);
for i := M to N do
if i mod 2 = 1 then
write (i,' ');
readln;
end.
Var a:array[1..15] of integer;
i,s:integer;
Begin
I:=1;
While i<=15 do
Begin
Write('Nhap phan tu thu ',i,' = ');readln(a[i]);
s:=s+a[i];
i:=i+1;
End;
Write('Tong la ',s);
Readln;
End.
Bài 1:program sothuc;
uses crt;
var a:array[1..10] of real;s,i,j:real;
begin
s:=0;
for i:=1 to 10 do begin writeln('A[',i,']=');readln(a[i]); end;
for i:=1 to 10 do if a[i]<0 then
for j:=1 to 10 do
begin a[j]:=sqr(a[i]); s:=s+a[j]; end;
writeln('tong binh phuong cac so am la: ',s:2:2); readln;
end. (Khi nào mình kiểm tra chạy lại trên phần mềm rồi sửa lại nếu sai nhé)
Bài 2:
program soduong;
uses crt;
var a:array[1..100] of integer;s,i,n:integer;
begin
clrscr;
writeln('nhap do dai cua day');readln(n);
for i:=1 to n do begin
writeln('a[',i,']=');readln(a[i]);
if a[i] mod 2 = 0 then s:=s+a[i] end;
writeln('tong so duong trong day la',s:2:0);readln
end.
Bài 3: các số dương mà là số lẻ là sao thế bạn????
Program HOC24;
var n,d,i: integer;
B: array[1..100] of integer;
t: longint;
begin
write('Nhap N: '); readln(n);
for i:=1 to n do
begin
write('B[',i,']='); readln(b[i]);
end;
d:=0; t:=0;
for i:=1 to n do
if b[i]>0 then
begin
d:=d+1;
t:=t+b[i];
end;
writeln('Tong cac so duong trong day so la: ',t);
write('Co ',d,' so duong trong day');
readln
end.
uses crt;
var b:array[1..100] of longint;
n,i,d,s:longint;
begin
clrscr;
write('n='); readln(n);
for i:=1 to n do
begin
write('a[',i,']: '); readln(b[i]);
if b[i]>0 then begin
inc(d);
inc(s,b[i]);
end;
end;
writeln('Tong cac so duong: ',s);
writeln('Co ',d,' so duong');
readln;
end.
program bai1;
var a:array[1..100] of longint;
s:real,i,n:longint;
begin
repeat
write('N= ');
readln(n);
until n>0;
for i:=1to n do
begin
write('a[',i,']= ');
readln(a[i]);
end;
s:=0;
for i:=1o n do
s:=s+1/i;
write('S= ',s);
readln
end.