Những câu hỏi liên quan
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)
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)
Danh Nguyễn
Xem chi tiết
Nguyễn Lê Phước Thịnh
8 tháng 3 2022 lúc 7:23

Bài 1:

#include <bits/stdc++.h>

using namespace std;

long long x,n,i,t;

int main()

{

cin>>n;

t=0;

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

{

cin>>x;

if ((x<0) and (x%2!=0)) t=t+x;

}

cout<<t;

return 0;

}

Bình luận (0)
Ngáo Ngơ Alice
Xem chi tiết
nguyễn an phát
11 tháng 4 2021 lúc 12:02

program timtich;

uses  crt;

var i,n:integer;

tich:longint;

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

begin

clrscr;

write('nhap so n:');readln(n);

for i:=1 to n do

begin

write('nhap phan tu a[',i,']:');readln(a[i]);

end;

for i:=1 to n do

write(a[i]:4);

tich:=1;

writeln;

for i:=1 to n do

if a[i] mod 2=0 then tich:=tich*a[i];

writeln('tich ca phan tu chan cua mang la:',tich);

readln;

end.

program timtong;

uses  crt;

var i,n:integer;

tong:longint;

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

begin

clrscr;

write('nhap so n:');readln(n);

for i:=1 to n do

begin

write('nhap phan tu a[',i,']:');readln(a[i]);

end;

for i:=1 to n do

write(a[i]:4);

tong:=0;

writeln;

for i:=1 to n do

if a[i] mod 2=0 then tong:=tong+a[i];

writeln('tong cac phan tu chan cua mang la:',tong);

tong:=0;

writeln;

for i:=1 to n do

if a[i] mod 2=1 then tong:=tong+a[i];

writeln('tong cac phan tu le cua mang la:',tong);

readln;

end.

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

Bài 1: 

uses crt;

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

i,n,s:integer;

begin

clrscr;

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

for i:=1 to n do 

begin

write('A[',i,']='); readln(a[i]);

end;

s:=1;

for i:=1 to n do 

  if a[i] mod 2=0 then s:=s*a[i];

writeln(s);

readln;

end.

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

uses crt;

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

i,n,t1,t2:integer;

begin

clrscr;

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

for i:=1 to n do 

begin

write('A[',i,']='); readln(a[i]);

end;

t1:=0;

t2:=0;

for i:=1 to n do

begin

if a[i] mod 2=0 then t1:=t1+a[i]

else t2:=t2+a[i];

end;

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

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

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)
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)
Dang Hien
Xem chi tiết
Nguyễn Lê Phước Thịnh
19 tháng 12 2021 lúc 23:52

Bài 3: 

#include <bits/stdc++.h>

using namespace std;

long long a,b;

int main()

{

cin>>a>>b;

cout<<a%b;

cout<<a/b;

return 0;

}

Bình luận (0)
My Phạm
Xem chi tiết
Nguyễn Lê Phước Thịnh
20 tháng 12 2021 lúc 23:26

#include <bits/stdc++.h>

using namespace std;

long long a,b,c,t;

int main()

{

cin>>a>>b>>c;

t=0;

if (a%2!=0) t=t+a;

if (b%2!=0) t=t+b;

if (c%2!=0) t=t+c;

cout<<t;

return 0;

}

Bình luận (0)
Phan Thế Hùng
Xem chi tiết
Thanh Phong (9A5)
9 tháng 3 2023 lúc 10:07

Uses crt;

var i,n: integer;

begin clrscr;

readln(n);

for i:=1 to n do if(i mod 2<>0) then writeln(i);

readln;

end.

 

Bình luận (2)
Nguyễn Lê Phước Thịnh
9 tháng 3 2023 lúc 14:27

#include <bits/stdc++.h>

using namespace std;

int main()

{

int n,i;

cin>>n;

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

if (i%2==1) cout<<i<<" ";

return 0;

}

Bình luận (0)