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.
program tinh_toan;
uses crt;
var S;i:integer;
begin
S:=0;
for i:=2 to 100 do S:=S+1/i;
writeln(S);
readln;
end.
Var i,n:integer;
s:real;
Begin
Write('n = ');readln(n);
For i:=2 to n do s:=s+1/i;
Write('tong la ',s:10:2);
Readln;
End.
uses crt;
var i,n,t:integer;
begin
clrscr;
readln(n);
t:=0;
for i:=1 to n do if i mod 2=1 then t:=t+i;
writeln(t);
readln;
end.
tham khảo
uses crt;
var i,t:integer;
begin
clrscr;
t:=0;
for i:=1 to 10 do
t:=t+i;
writeln('Tong cac so tu nhien tu 1 toi 10 la: ',t);
readln;
end.
refer
uses crt;
var i: integer;
begin
clrscr;
for i:= 1 to 10 do
begin writeln ( ' O ' ) end;
readln
end.
uses crt;
var i,s:longint;
begin
clrscr;
s:=1;
for i:=1 to 10 do
s:=s*i;
writeln(s);
readln;
end.
Câu 1:
uses crt;
var a:array[1..100]of integer;
i,n,t,s:integer;
begin
clrscr;
write('Nhap n='); readln(n);
for i:=1 to n do
begin
write('A[',i,']='); readln(a[i]);
end;
t:=0;
s:=1;
dem:=0;
for i:=1 to n do
if a[i] mod 3=0 then
begin
inc(dem);
t:=t+a[i];
s:=s*a[i];
end;
if dem=0 then writeln('Khong co so chia het cho 3 trong day')
else begin
writeln('Tong cac so chia het cho 3 la: ',t);
writeln('Tich cac so chia het cho 3 la: ',s);
end;
readln;
end.
Câu 2:
uses crt;
var a:array[1..100]of integer;
i,n,dem,t:integer;
begin
clrscr;
write('Nhap n='); readln(n);
for i:=1 to n do
begin
write('A[',i,']='); readln(a[i]);
end;
dem:=0;
t:=0;
for i:=1 to n do
if a[i] mod 2=0 then
begin
inc(dem);
t:=t+a[i];
end;
writeln('So so chan la: ',dem);
writeln('Tong cac so chan la: ',t);
readln;
end.
Program Tin_hoc;
Uses crt;
Var i,n,dem:integer;
a:array[1..100000] of integer;
Begin
clrscr;
Write('Nhap 1 so nguyen duong n: ');readln(n);
dem:=0;
Writeln('Nhap ',n,' phan tu:');
For i:= 1 to n do
Begin
Write('A[',i,'] = ');
readln(a[i]);
If a[i] mod 2 = 0 then inc(dem);
End;
Writeln('Day vua nhap la:');
For i:= 1 to n do write(a[i],' ');writeln;
Writeln('Day so vua nhap co ',dem,' so chan');
readln;
End.
uses crt;
var a:array[1..100]of integer;
i,n,dem: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
write(a[i]:4);
writeln;
dem:=0;
for i:=1 to n do
if a[i] mod 2=0 then inc(dem);
writeln('So so chan la: ',dem);
readln;
end.
program DemSoChiaHetCho5;
var
n, count, i: integer;
begin
write('Nhap vao so n: ');
readln(n);
count := 0;
i := 1;
while i <= n do
begin
if i mod 5 = 0 then // kiem tra so i co chia het cho 5 khong
count := count + 1;
i := i + 1;
end;
writeln('So luong so tu nhien chia het cho 5 tu 1 den ', n, ' la: ', count);
end.
tham khảo
Program chuong_trinh_tinh_tong;
User crt;
var n,i:integer;
S:real;
begin;
write('nhap n = ');
readln(n);
s:=0;
for i :=1 to n do S :=S + 1/i;
writeln('tong S = ',S:5:2);
readln
end.
tham khảo
Program chuong_trinh_tinh_tong;
User crt;
var n,i:integer;
S:real;
begin;
write('nhap n = ');
readln(n);
s:=0;
for i :=1 to n do S :=S + 1/i;
writeln('tong S = ',S:5:2);
readln
end.