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 TinhTong;
uses crt;
var
N, i, j, tich: integer;
S: real;
begin
clrscr;
write('Nhap so nguyen N: ');
readln(N);
S := 0;
tich := 1;
for i := 1 to N do
begin
tich := tich * i;
S := S + tich;
end;
writeln('Tong S = ', S:0:2);
readln;
end.
Uses crt;
var i,n,y: integer;
begin clrscr;
readln(n);
for i:=1 to n do s:=i*i;
Writeln(s);
readln;
end.
Câu 1:
Program HOC24;
var i,n: integer;
t: longint;
write('Nhap N: '); readln(n);
t:=1;
for i:=1 to n do t:=t*i;
write(n,'! = ',t);
readln
end.
var i,n:integer;
s:real;
begin
write('Nhap n = ');readln(n);
for i:=1 to n do
s:=s+1/(3*i+2);
write('Tong la ',s:10:2);
readln;
end.
uses crt;
var x,n,i,t:integer;
begin
clrscr;
readln(n);
t:=0;
for i:=1 to n do
begin
readln(x);
if x mod 2=0 then t:=t+x;
end;
writeln(t);
readln;
end.
program ideone;
var i,n,x,res:longint;
begin
readln(n);
res:=0;
for i:=1 to n do
begin
read(x);
if x mod 2 = 0 then
res:=res+x;
end;
write(res);
end.
1.
Var i ,n : integer;
S , T : real;
Begin
Write ('n:') ;
Read (n) ;
S:= 0;
T:= 1;
For i:= 1 to n do
S:= S + i;
T:= T * i;
Writeln (' Tong cua ' ,n,' , S );
Writeln (' Tich của ' ,n,', T );
Readln;
End.
2.
program SumAndProductOfNumbers;
var
n, m, i, sum, product: integer;
begin
writeln('Enter the values of n and m: ');
readln(n, m);
sum := 0;
product := 1;
for i := n to m do
begin
sum := sum + i;
product := product * i;
end;
writeln('The sum of numbers from ', n, ' to ', m, ' is: ', sum);
writeln('The product of numbers from ', n, ' to ', m, ' is: ', product);
end.