Những câu hỏi liên quan
Nguyễn Văn Hồng
Xem chi tiết
Nguyễn Lê Phước Thịnh
3 tháng 1 2023 lúc 14:34

#include <bits/stdc++.h>

using namespace std;

long long n,i,s=1;

int main()

{

cin>>n;

for (int i=1; i<=n; i++) 

s=s*i;

cout<<s;

}

Bình luận (0)
03. Phạm Nguyễn Phương A...
Xem chi tiết
Như Ý
Xem chi tiết
Phía sau một cô gái
1 tháng 5 2023 lúc 19:27

Câu 1:

program Tinhtong:

var

     n, i, sum: integer;

begin

     write('Nhap n: ');

     readln(n);

     sum := 0;

     for i := 2 to n do

     begin

          if i mod 2 = 0 then

          begin

               sum := sum + i;

          end;

     end;

     writeln('Tong cac so chan tu 2 toi ', n, ' la ', sum);

     readln; 

end.

Câu 2:

program Tinhtong:

var

     n, i, sum: integer;

begin

     write('Nhap n: ');

     readln(n);

     sum := 0;

     for i := 1 to n do

     begin

          if i mod 2 = 1 then

          begin

               sum := sum + i;

          end;

     end;

     writeln('Tong cac so le tu 1 toi ', n, ' la ', sum);

     readln;

end.

Bình luận (1)
Lâm Khả Doanh
Xem chi tiết
Nguyễn Lê Phước Thịnh
28 tháng 2 2023 lúc 22:28

1:

uses crt;

var n,i,t:integer;

begin

clrscr;

readln(n);

t:=0;

for i:=1 to n do

t:=t+i*i;

write(t);

readln;

end.

Bình luận (0)
Lê Chiêu Nguyên	Vũ
4 tháng 4 2023 lúc 10:21

2

program bt2;

var i,n,t:integer;

begin

readln(n);

s:=0;

for i:=1 to n do

if i mod 2 = 1 then s:=s+i;

readln;

end.

Bình luận (0)
NGUYỄN LÊ XUÂN THỊNH
Xem chi tiết
Nguyễn Lê Phước Thịnh
20 tháng 2 2023 lúc 0:38

Câu 6:

uses crt;

var n,i:integer;

begin

clrscr;

readln(n);

for i:=1 to n do 

if n mod i=0 then write(i:4);

readln;

end.

5:

uses crt;

var n,i,dem:integer;

begin

clrscr;

readln(n);

dem:=0;

for i:=0 to n do

if i mod 2=1 then 

begin

write(i:4);

dem:=dem+1;

end;

writeln;

writeln(dem);

readln;

end.

Bình luận (0)
Thu Anh
Xem chi tiết
Phía sau một cô gái
14 tháng 3 2023 lúc 15:44

program TongN;

var

     n, i, tong: integer;

begin

     tong := 0;

     writeln('Nhap so nguyen duong N: ');

     readln(n);

     i := 0;

     while i < n do

     begin

          i := i + 1;

          tong := tong + i;

     end;

     writeln('Tong cac so tu 1 den ', n, ' la ', tong);

     readln;

end.

Bình luận (0)
Nguyenthanh
Xem chi tiết
Nguyễn Lê Phước Thịnh
9 tháng 5 2021 lúc 20:44

Câu 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(s);

readln;

end.

Bình luận (0)
Nguyễn Lê Phước Thịnh
9 tháng 5 2021 lúc 20:44

Câu 2: 

uses crt;

var t,i,n:integer;

begin

clrscr;

write('Nhap n='); readln(n);

t:=0;

for i:=1 to n do

t:=t+i;

writeln(t);

readln;

end.

Bình luận (0)
Truy Kích 3.0
29 tháng 5 2021 lúc 9:51

Bài 2 dùng công thức n*(n+1)/2

Bình luận (0)
Nguyễn Thuận
Xem chi tiết
Bùi Anh Tuấn
17 tháng 3 2021 lúc 20:05

Bình luận (0)
Bùi Anh Tuấn
17 tháng 3 2021 lúc 20:05

Bình luận (0)
Nguyễn Lê Phước Thịnh
17 tháng 3 2021 lúc 21:50

Câu 3: 

uses crt;

var n,i,kt:integer;

begin

clrscr;

write('Nhap n='); readln(n);

if n>1 then 

begin

kt:=0;

for i:=2 to trunc(sqrt(n)) do 

  if n mod i=0 then kt:=1;

if kt=0 then writeln(n,' la so nguyen to')

else writeln(n,' la hop so');

end

else writeln(n,' khong la so nguyen to cung khong la hop so');

readln;

end.

Bình luận (1)
0o0 Nhok kawaii 0o0
Xem chi tiết
Minh Nguyệt Điêu
Xem chi tiết
Kiều Vũ Linh
8 tháng 2 2023 lúc 9:46

var i,n,so:integer;

s:longint;

begin

write('Nhap N = ');readln(n);

for i:=1 to n do

begin

write('Nhap so thu ',i,' = ');readln(so);

s:=s+so;

end;

write('Tong la ',s);

readln;

end.

Bình luận (0)