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.
Var i,n,p:longint;
Begin
Write('Nhap n = ');readln(n);
i:=1;
p:=1;
While i<=n do
Begin
i:=i+1;
p:=p*i;
End;
Write('Tich la ',p);
Readln;
End.
uses crt;
var a:array[1..100]of integer;
i,n,t:integer;
begin
clrscr;
write('nhap n='); readln(n);
for i:=1 to n do
begin
write('A[',i,']='); readln(a[i]);
end;
t:=0;
i:=1;
while i<=n do
begin
t:=t+a[i];
inc(i);
end;
writeln(t/n:4:2);
readln;
end.
#include <bits/stdc++.h>
using namespace std;
int main()
{
int n,t=0,i,dem=0;
cin>>n;
for (int i=1; i<=n; i++)
if (i%2==0)
{
t=t+i;
dem++;
}
cout<<fixed<<setprecision(2)<<(t*1.0)/(dem*1.0);
return 0;
}
Bài 1:
uses crt;
var n,i:integer;
s:real;
begin
clrscr;
write('Nhap n='); readln(n);
s:=1;
for i:=1 to n do
s:=s*i;
writeln(n,'!=',s:0:0);
readln;
end.
1).
program oken;
uses crt;
var n,i: integer;
gt: qword;
begin
write('nhap n: '): readln(n);
gt:=1;
for i:=1 to n do gt:=gt*i;
writeln('N!=',gt);
readln;
end.
2).
program tongcacsole;
uses crt;
var t,i:longint;
begin
clrscr;
for i:=1 to 203 do
if i mod 2 = 1 then t:=t+i;
write(t);
end.
3).
program tongcacsochan;
uses crt;
var t,i:longint;
begin
clrscr;
for i:=1 to 20 do
if i mod 2 = 0 then t:=t+i;
write(t);
end.
uses crt;
var i,n:integer;
s:real;
begin
clrscr;
write('Nhap n='); readln(n);
s:=1;
i:=1;
while i<=n do
begin
s:=s*i;
i:=i+1;
end;
writeln(s:0:0);
readln;
end.
var i,n,s:longint;
begin
read(n); if n<2 then break;
for i:=3 to n do s:=s+i;
write(s);
end.
Var i,n:integer;
t:longint;
Begin
Write('n = ');readln(n);
i:=2;
While i<=n do
Begin
t:=t+i;
i:=i+1;
End;
Write('Tong la ',t);
Readln
End.
uses crt;
var n,i:longint;
gt:real;
begin
clrscr;
write('Nhap n='); readln(n);
gt:=1;
for i:=1 to n do
gt:=gt*i;
writeln(n,'!=',gt:0:0);
readln;
end.