Những câu hỏi liên quan
Nguyenquochuy
Xem chi tiết
Kiều Vũ Linh
9 tháng 3 2023 lúc 7:37

var i,n,s,du,dem:integer;

Begin

While n<=0 do

Begin

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

End;

For i:=1 to n do

If n mod i = 0 then

Begin

Write(i:7);

du:=du+1;

s:=s+i;

End;

Writeln('So uoc cua ',n,' la ',du);

Writeln('Tong cac uoc cua ',n,' la ',s);

For i:=1 to s do

If s mod i = 0 then dem:=dem+1;

If dem=2 then write(s,' la so nguyen to')

Else write(s,' khong la so nguyen to');

Readln;

End.

Bình luận (1)
Trần Thị Mai Ngọc
Xem chi tiết
nguyễn an phát
18 tháng 4 2021 lúc 20:48

program tim_uoc;

uses crt;

var i,n,tong:integer;

begin

clrscr;

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

i:=1;tong:=0;

writeln('cac uoc cua ',n,' la:');

while i<=n do

if n mod i=0 then

begin

write(i:3);

inc(i);

end;

writeln;

i:=1;writeln('cac uoc chan:');

while i<=n do

begin

if n mod i=0 then 

begin

if i mod 2=0 then write(i:3);

tong:=tong+i;

end;

end;

writeln;

write('tong cac uoc chan:',tong);

readln;

end.

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

uses crt;

var n,i,t:integer;

begin

clrscr;

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

i:=1;

writeln('Cac uoc cua ',n,' la: ');

while i<=n do

  begin

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

i:=i+1;

end;

writeln;

writeln('Cac uoc chan cua ',n,' la: ');

t:=0;

i:=1;

while i<=n do 

  begin

if (n mod i=0) then

begin

t:=t+i;

write(i:4);

end;

inc(i);

end;

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

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)
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)
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)
日光
Xem chi tiết
Ng Ngọc
10 tháng 3 2022 lúc 9:46

???

Bình luận (0)
Kaito Kid
10 tháng 3 2022 lúc 9:46

???

Bình luận (0)
Keiko Hashitou
10 tháng 3 2022 lúc 9:46

ko đăng linh tinh

Bình luận (0)
Giap Nguyen Van
Xem chi tiết
Nguyễn Lê Phước Thịnh
11 tháng 3 2022 lúc 15:48

uses crt;

var n,i,t1,t2:integer;

begin

clrscr;

t1:=0;

t2:=0;

repeat

readln(n);

if n mod 2=0 then t1:=t1+n

else t2:=t2+n;

until n=0;

writeln(t1,' ',t2);

readln;

end.

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)
Shirley Hanamura
Xem chi tiết