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.
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.
T:=0;
for i:= 1 to 20 do
If i mod 2 = 1 then tong:=i + T;
#include <bits/stdc++.h>
using namespace std;
long long n,i,t;
int main()
{
cin>>n;
t=0;
for (i=1; i<=n; i++)
if (i%2==0) t+=i;
cout<<t;
return 0;
}
#include <bits/stdc++.h>
using namespace std;
int main()
{
int n,t=0;
cin>>n;
for (int i=1; i<=n; i++)
if (i%6==0) t+=i;
cout<<t;
return 0;
}
#include <bits/stdc++.h>
using namespace std;
long long n,i,t;
int main()
{
cin>>n;
t=0;
for (i=1; i<=n; i++)
if (i%2!=0) t+=i;
cout<<t;
return 0;
}
n = int(input("Nhap n: "))
sum_even = 0
for i in range(2, n+1, 2):
sum_even += i
print("Tong cac so chan lien tiep den", n, "la:", sum_even)
python ha:0?
Program HOC24;
Uses crt;
var i,j: integer;
j:=1; i:=0;
while(j<=50) do
begin
j:=j+1;
if(j mod 2=0) then i:=i+j;
end;
writeln(i);
readln;
end.
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.
* Sử dụng For ... do
Var i,s:integer;
Begin
For i:=1 to 10 do
s:=s+i;
Write('Tong la ',s);
Readln;
End.
* Sử dụng While ... do
Var i,s:integer;
Begin
i:=1;
While i<=10 do
Begin
s:=s+i;
i:=i+1;
End;
Write('tong la ',s);
Readln;
End.
begin
A:=0;
for i:=1 to 20 do A:= A+i*2;
writeln (' tong =',A);
readln;
end.
For i:=1 to 20 do if i mod 2=0 then t:=t+i;