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.
c1:
#include <bits/stdc++.h>
using namespace std;
long long i,n,s;
int main()
{
cin>>n;
s=1;
for (i=1; i<=n; i++) s=s*i;
cout<<s;
return 0;
}
Câu 2:
#include <bits/stdc++.h>
using namespace std;
long long i,n,s;
int main()
{
cin>>n;
s=1;
for (i=1; i<=n; i++) if (i%2==0) s=s*i;
cout<<s;
return 0;
}
1. Uses crt;
var n,i: integer;
begin clrscr;
readln(n);
for i:=1 to n do write(i:3);
readln;
end.
2. Uses crt;
var n,i: integer;
begin clrscr;
readln(n);
for i:=1 to n do if(i mod 2 = 0) then write(i:3);
readln;
end.
#include <bits/stdc++.h>
using namespace std;
long long i,n;
int main()
{
cin>>n;
for (i=1; i<=n; i++) if (i%3==0) cout<<i<<" ";
return 0;
}
Câu 1:
Program HOC24;
var i,p: integer;
t: longint;
begin
write('Nhap P: '); readln(p);
t:=0;
for i:=1 to p do if i mod 2<>0 then t:=t+i;
write('Tong cac so le la: ',t);
readln
end.
a)
uses crt;
var i,n:integer;
begin
clrscr;
repeat
write('Nhap n='); readln(n);
until n<100;
if n mod 2=0 then
begin
for i:=0 to n do
if i mod 2=0 then write(i:4);
end
else writeln(n,' khong la so chan');
readln;
end.
b)
uses crt;
var i,n:integer;
begin
clrscr;
repeat
write('Nhap n='); readln(n);
until n<100;
if n mod 2=1 then
begin
for i:=1 to n do
if i mod 2=1 then write(i:4);
end
else writeln(n,' khong la so le');
readln;
end.
uses crt;
var i,n,d:longint;
begin
d:=0;
writeln('nhapn=');read(n);
for i:=1 to n do
begin
if i mod 3=0 then write(i,' ');
if i mod 3=0 then d:=d+i;
end;
writeln('tong=',d);
readln;
end;
#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%3==0) t+=i;
cout<<t;
return 0;
}
Bài 1:
uses crt;
var n,i,dem:integer;
begin
clrscr;
repeat
write('Nhap n='); readln(n);
until n>0;
writeln('Cac so chia het cho 5 trong khoang tu 1 toi ',n,' la: ');
dem:=0;
for i:=1 to n do
if i mod 5=0 then
begin
write(i:4);
inc(dem);
end;
writeln;
writeln('So cac so chia het cho 5 trong khoang tu 1 toi ',n,' la: ',dem);
readln;
end.
Bài 2:
uses crt;
var i:byte;
s:real;
begin
clrscr;
s:=1;
for i:=15 to 35 do
s:=s*i;
writeln('Tich cac so tu 15 toi 35 la: ',s:4:2);
readln;
end.
Bài 3:
uses crt;
var i,n:integer;
s:real;
begin
clrscr;
repeat
write('Nhap n='); readln(n);
until n>0;
s:=1;
for i:=1 to n do
s:=s*i;
writeln('Tich cac so tu 1 toi ',n,' la: ',s:4:2);
readln;
end.
Bài 3:
Program hotrotinhoc_hoc24;
var i,n: integer;
t:longint;
begin
write('Nhap n='); readln(n);
t:=1;
for i:=1 to n do t:=t*i;
write(t);
readln
end.