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 HOC24;
var i,n: integer;
s: real;
begin
write('Nhap N: '); readln(n);
s:=0;
for i:=1 to n do s:=s+1/(i*i*i);
write('S = ',s:6:2);
readln
end.
program Tinh_S;
var i,n:integer;
S:real;
begin
writeln('Nhap so n=') ; readln(n);
i:=1 ; S:=0;
while i<=n do
begin
S:=S+1/n*(n+1); i:=i+1;
end;
writeln('Tong S=',S);
readln
end.
program TinhTongWhileDo;
var
n, i: integer;
S: real;
begin
write('Nhap so n: ');
readln(n);
S := 0;
i := 1;
while i <= 2*n do
begin
S := S + 1/i;
i := i + 1;
end;
writeln('Tong S=1/1+1/2+1/3+1/4+...+1/2n la: ', S:0:2);
readln;
end.
uses crt;
var i,s:integer;
begin
for i:=1 to 50 do writeln(*);
s:=0;
For i:=1 to 99 do while i mod 2 = 1 do s:=s+i;
writeln('tong cua phep tinh la',s); readln;
end.
uses crt;
var i,t:integer;
begin
clrscr;
for i:=1 to 50 do
write('*');
writeln;
t:=0;
for i:=1 to 100 do
if i mod 2=1 then t:=t+i;
writeln(t);
readln;
end.
Uses crt;
var s,n,i: integer;
begin clrscr;
readln(n);
for i:=1 to n do if(n mod 2<>0) then s:=s+i;
writeln(s);
readln;
end.
bạn có thể giải thik cho mik vì sao lại là for i:=1 to n do if(n mod 2<>0) then s:=s+i đc ko
cảm ơn bạn nhìu
Uses Crt;
Var A : array [1..1000] of longint;
n, m, d, t, i, S, k : longint;
Begin
//Phan A
Clrscr;
Writeln(' Phan A ');
Write(' Ban hay nhap 1 so n bat ky: ');
Readln(n);
Write(' Cac so chia het cho ba tu 1 den ',n,' la: ');
For i:=1 to n do
If (i mod 3) = 0 then Write(' ',i);
//Phan B
Writeln;
Writeln(' Phan B ');
Write(' Ban hay nhap 1 so m bat ky: ');
Readln(m);
For i:=1 to m do
Begin
Write(' Ban hay nhap hang tu thu ',i,': ');
Readln(A[i]);
S:= S+A[i];
End;
Write(' Tong cua day so tren la: ',S);
//Phan C
Writeln;
Writeln(' Phan C ');
Write(' Ban hay nhap 1 so d bat ky: ');
Readln(d);
Write(' Ban hay nhap so K: ');
Readln(k);
For i:=1 to n do
Begin
Write(' Ban hay nhap hang tu thu ',i,': ');
Readln(A[i]);
If ((A[i] div k)=1)then t:=t+1;
End;
Write(' Co tat ca ',t,' so giong ',k);
Readln;
End.
program Tinh_Tong;
var
n, i, A: integer;
begin
write('Nhap n: ');
readln(n);
i := 0;
A := 0;
while i <= (2 * n + 1) do
begin
A := A + i;
i := i + 2;
end;
writeln('Tong cac so le tu 1 den 2*n+1 la: ', A);
readln;
end.
program Tinh_Tong;
var n, A, i: integer;
begin
write('Nhap vao so nguyen duong n: ');
readln(n);
A := 0;
i := 0;
while i <= n do
begin
A := A + 2 * i + 1;
i := i + 1;
end;
writeln('Tong A = 1 + 3 + 5 + ... + (2 * ', n, ' + 1) = ', A);
end.