Những câu hỏi liên quan
Selena Flynn
Xem chi tiết
Nguyễn Lê Phước Thịnh
8 tháng 3 2022 lúc 23:03

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;

}

Bình luận (0)
Anh Quynh
Xem chi tiết
Kiều Vũ Linh
27 tháng 4 2023 lúc 17:54

Var array:[1..1000] of integer;

i,n:integer;

Begin

Write('n = ');readln(n);

For i:=1 to n do

Begin

Write('Nhap so thu ',i,' = ');readln(a[i]);

End;

Write('Cac so vua nhap la ');

For i:=1 to n do write(a[i]:8);

Readln

End.

Bình luận (0)
Hiếu
Xem chi tiết
MinasuaSan Channel
Xem chi tiết
huỳnh duy cát
Xem chi tiết
Nguyễn Lê Phước Thịnh
20 tháng 3 2021 lúc 19:53

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ình luận (0)
Nguyễn Lê Phước Thịnh
20 tháng 3 2021 lúc 19:53

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.

Bình luận (0)
Lê Đăng Khôi
Xem chi tiết
Nguyễn Lê Phước Thịnh
21 tháng 2 2023 lúc 15:39

1:

uses crt;

var t,x,i,n:integer;

begin

clrscr;

t:=0;

n:=10;

for i:=1 to n do

begin

readln(x);

t:=t+x;

end;

write(t);

readln;

end.

2: 

uses crt;

var dem,x,i,n:integer;

begin

clrscr;

dem:=0;

n:=10;

for i:=1 to n do

begin

readln(x);

if x mod 2=0 then inc(dem);

end;

write(dem);

readln;

end.

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

3

program Cacsole;
uses crt;
var M, N, i: integer;
begin
clrscr;
write ('Nhap M= '); readln(M);
write ('Nhap N= '); readln(N);
for i := M to N do

if  i mod 2 = 1 then
write (i,' ');
readln;
end.

Bình luận (1)
An An Nguyễn
Xem chi tiết
Phan Thu
Xem chi tiết
phạm hương trà
Xem chi tiết
Công Chúa Sakura
4 tháng 1 2017 lúc 22:32

a)

uses crt;

VAR

n, d, i: integer;

BEGIN

clrscr;

Writeln ('Nhap vao n='); readln (n);

d : = 1;

For i: = 1 to n do

d: = d*i;

Writeln ('d=',d);

Readln;

END.

c)

uses crt;

VAR

n, i, demuoc: integer;

BEGIN

clrscr;

Writeln ('Nhap vao n='); readln (n);

demuoc: = 0;

For i: = 1 to n do

If n mod i = 0 then

demuoc : = demuoc + 1;

If demuoc = 2 then

Writeln ('n la so nguyen to')

ELSE

Writeln ('n khong phai la so nguyen to');

Readln ;

END.

Còn phần b bạn tự nghĩ nha!

Chúc bạn học tốt!

Bình luận (0)