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)
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)
Phan Thị Ka
Xem chi tiết
Minh Lệ
19 tháng 3 2023 lúc 22:40

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.

Bình luận (0)
Minh Lệ
19 tháng 3 2023 lúc 22:41

Câu 2:

Program HOC24;

var i,n: integer;

t: longint;

begin

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

t:=0;

for i:=1 to n do if i mod 2=0 then t:=t+i;

write('Tong cac so chan la: ',t);

readln

end.

Bình luận (0)
Minh Lệ
19 tháng 3 2023 lúc 22:42

Câu 3:

Program HOC24;

var i,t,n: integer;

begin

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

t:=0;

for i:=1 to n do if n mod i=0 then t:=t+i;

write('Tong cac uoc cua ',n,' la: ',t);

readln

end.

Bình luận (0)
minh tiến dương
Xem chi tiết
Phạm Đức
Xem chi tiết
Nguyễn Lê Phước Thịnh
30 tháng 12 2021 lúc 23:41

#include <bits/stdc++.h>

using namespace std;

long long n,i,t,dem;

int main()

{

cin>>n;

t=0;

dem=0;

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

if (i%2==1)

{

t=t+i;

dem++;

}

cout<<fixed<<setprecision(2)<<(t*1.0)/(dem*1.0);

return 0;

}

Bình luận (0)
Như Phi
Xem chi tiết
Nguyễn Lê Phước Thịnh
12 tháng 1 2022 lúc 22:15

#include <bits/stdc++.h>

using namespace std;

long long n,i,s,dem;

int main()

{

cin>>n;

s=0;

dem=0;

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

{

if (i%2==1) 

{

dem++;

s=s+i;

}

}

cout<<fixed<<setprecision(2)<<(s*1.0)/(dem*1.0);

return 0;

}

Bình luận (0)
Kiều Vũ Linh
13 tháng 1 2022 lúc 11:30

Var i,n:integer;

Begin

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

For i:=1 to n do

If i mod 2 = 1 then write(i,'    ');

Readln;

End.

Bình luận (0)
khánh băng
Xem chi tiết
Nguyễn Lê Phước Thịnh
28 tháng 2 2023 lúc 22:35

uses crt;

var a:array[1..100]of integer;

i,n,dem,kt,j:integer;

begin

clrscr;

readln(n);

for i:=1 to n do write(i:4);

writeln;

for i:=2 to n do

begin

kt:=0;

for j:=2 to i-1 do 

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

if kt=0 then write(i:4);

end;

readln;

end.

Bình luận (0)
Pham Thuan
Xem chi tiết
Phía sau một cô gái
20 tháng 4 2023 lúc 21:31

program SoChanDenN;

var

     n, i: Integer;

begin

     Write('Nhap n: ');

     Readln(n);

     Write('Cac so chan tu 1 den ', n, ' la: ');

     for i := 1 to n do

     begin

          if i mod 2 = 0 then

               Write(i, ' ');

     end;

end.

Bình luận (0)
Hưng Quốc
Xem chi tiết
HT.Phong (9A5)
31 tháng 3 2023 lúc 16:51

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.

Bình luận (0)
láobốlaos
31 tháng 3 2023 lúc 16:54

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.

Bình luận (0)
Nguyễn Hoàng Duy
2 tháng 4 2023 lúc 16:31

1.

program InDaySoTuNhien;
var n, i: integer;
begin
   write('Nhap so nguyen duong n: ');
   readln(n);

   writeln('Day so tu 1 den ', n, ' la:');
   for i := 1 to n do
      write(i, ' ');
end.

2.

program InSoChan;
var
   n, i: integer;
begin
   write('Nhap so nguyen n: ');
   readln(n);

   writeln('Cac so nguyen chan trong khoang tu 1 den ', n, ' la:');
   for i := 1 to n do
   begin
      if i mod 2 = 0 then
         write(i, ' ');
   end;
end.

Bình luận (0)