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)
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)
Huỳnh Hoài Nguyên
Xem chi tiết
Nguyễn Lê Phước Thịnh
21 tháng 3 2021 lúc 22:23

uses crt;

var i,n,t:integer;

begin

clrscr;

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

i:=1;

t:=0;

while i<=n do 

begin

if i mod 2=0 then t:=t+i;

i:=i+1;

end;

write(t);

readln;

end.

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)
Hàn Nhật Hạ
Xem chi tiết
Uyên  Thy
15 tháng 3 2022 lúc 23:45

Tham khảo nhen
Program Tin_hoc;

var a: integer;

begin

write('Nhap a: '); readln(a);

if a=0 then write('a la so 0') else

if a mod 2=0 then write(a,' la so chan') else write(a,' la so le');

readln

end.

Bình luận (0)
kodo sinichi
16 tháng 3 2022 lúc 5:54

Tham khảo


Program Tin_hoc;

var a: integer;

begin

write('Nhap a: '); readln(a);

if a=0 then write('a la so 0') else

if a mod 2=0 then write(a,' la so chan') else write(a,' la so le');

readln

end.

Bình luận (0)
Nguyễn Lê Phước Thịnh
16 tháng 3 2022 lúc 7:28

Câu 2:

#include <bits/stdc++.h>

using namespace std;

long long i;

int main()

{

for (i=1; i<=20; i++) cout<<i<<" ";

return 0;

}

Bình luận (0)
Tú Uyên
Xem chi tiết
Nguyễn Lê Phước Thịnh
24 tháng 2 2022 lúc 23:33

#include <bits/stdc++.h>

using namespace std;

long long a[15],i,n=15,s,t;

int main()

{

for (i=1; i<=n; i++) cin>>a[i];

s=1;

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

if (a[i]%2==0)

{

cout<<a[i]<<" ";

s*=a[i];

}

cout<<endl;

cout<<"Tich cac so chan la: "<<s<<endl;

t=0;

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

if (a[i]<0) t=t+a[i]*a[i];

cout<<t;

return 0;

}

Bình luận (0)
Ánh Thi
Xem chi tiết
Ngô Bá Hùng
26 tháng 4 2023 lúc 23:35

program TongSoChan;

var
  n, i, x, tong: integer;

begin
  write('Nhap so nguyen n: ');
  readln(n);
  
  tong := 0;
  
  for i := 1 to n do
  begin
    read(x);
    if x mod 2 = 0 then
      tong := tong + x;
  end;
  
  writeln('Tong cac so chan la: ', tong);
  readln; 
end.

Bình luận (0)
Vân anh
Xem chi tiết
Phía sau một cô gái
22 tháng 4 2023 lúc 20:18

program TongChanLe;

var

     n,i, chans, les: integer; a: array[1..100] of integer;

begin

     chans := 0;

     les := 0;

     write('Nhap n: ');

     readln(n);

     for i:=1 to n do

     begin

          write('Nhap so thu ', i, ': ');

          readln(a[i]);

          if a[i] mod 2 = 0 then

               chans := chans + a[i]

          else

               les := les + a[i];

     end;

     writeln('Tong cac so chan la: ', chans);

     writeln('Tong cac so le la: ', les);

     readln;

end.

Bình luận (1)
Nguyễn Võ Phương Uyên
Xem chi tiết
Bảo Trâm
Xem chi tiết
Nguyễn Lê Phước Thịnh
6 tháng 4 2022 lúc 23:03

#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;

}

Bình luận (0)