Bạn chưa đăng nhập. Vui lòng đăng nhập để hỏi bài

Những câu hỏi liên quan
Chira Nguyên
Xem chi tiết
Nguyễn Lê Phước Thịnh
23 tháng 2 2021 lúc 20:20

for i:=1 to n do 

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

Nguyễn Lê Phước Thịnh
23 tháng 2 2021 lúc 20:21

Chương trình đầy đủ:

uses crt;

var n,i:integer;

begin

clrscr;

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

for i:=1 to n do 

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

readln;

end.

mistud
Xem chi tiết
Nguyễn Lê Phước Thịnh
10 tháng 12 2021 lúc 23:17

2:

#include <bits/stdc++.h>

using namespace std;

long long n,i;

int main()

{

cin>>n;

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

if (n%i==0) cout<<i<<" ";

return 0;

}

duy lê
Xem chi tiết
Minh Lệ
31 tháng 3 2021 lúc 16:53

Program HOC24;

var i,n: integer;

begin

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

write('Cac so tu 1 den ',n,' chia het cho 2 la: ');

for i:=1 to n do if i mod 2=0 then write(i,' ');

writeln;

for i:=1 to n do if i mod 2=1 then write(i,' ');

readln

end.

Dân Phạm Văn
Xem chi tiết
Nguyễn Lê Phước Thịnh
7 tháng 5 2021 lúc 21:20

Bài 1: 

uses crt;

var n,i,kt:integer;

begin

clrscr;

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

kt:=0;

for i:=2 to n-1 do 

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

if (kt=0) and (n>1) then writeln(n,' la so nguyen to')

else writeln(n,' khong la so nguyen to');

readln;

end.

Nguyễn Lê Phước Thịnh
7 tháng 5 2021 lúc 21:21

Bài 2: 

uses crt;

var n,i:integer;

begin

clrscr;

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

for i:=1 to n do 

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

readln;

end.

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.

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.

Trí Nguyễn
Xem chi tiết
Phía sau một cô gái
7 tháng 7 2023 lúc 20:19

program bai_toan;

var

      N, i, sum: integer;

begin

      write('Nhap so N: ');

      readln(N);

      write('Cac uoc cua ', N, ' khong ke ', N, ' la: ');

      for i := 1 to N - 1 do

            if N mod i = 0 then

                  write(i, ' ');

      writeln;

      sum := 0;

      for i := 1 to N - 1 do

      begin

            if N mod i = 0 then sum := sum + i;

      end;

      if sum = N then writeln(N, ' la so hoan hao')

      else writeln(N, ' khong phai la so hoan hao');

      writeln;

      writeln('Tat ca so hoan hao trong pham vi 1 -> ', N, ' la:');

      for i := 1 to N do

      begin

            sum := 0;

            for j := 1 to i - 1 do

            begin

                  if i mod j = 0 then sum := sum + j;

            end;

            if sum = i then writeln(i);

      end;

      readln;

end.

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.

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.

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.

nguyennhalam
Xem chi tiết
Nguyễn Lê Phước Thịnh
24 tháng 12 2021 lúc 13:41

#include <bits/stdc++.h>

using namespace std;

long long a[10000],i,n,dem;

int main()

{

cin>>n;

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

dem=0;

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

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

{

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

dem++;

}

cout<<endl;

cout<<dem;

return 0;

}

Nhảy chân sáo mà từ từ đ...
Xem chi tiết
Nguyễn Lê Phước Thịnh
15 tháng 3 2022 lúc 20:38

#include <bits/stdc++.h>

using namespace std;

long long n,i,a[1000],t,dem,t1;

int main()

{

cin>>n;

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

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

if (a[i]%2==0) cout<<a[i]<<" ";

cout<<endl;

t=0;

dem=0;

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

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

{

t=t+a[i];

dem++;

}

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

t1=0;

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

if (a[i]%2!=0 || a[i]%3==0) t1+=a[i];

cout<<t1;

return 0;

}