Những câu hỏi liên quan
Duy Thanh Bùi
Xem chi tiết
Duy Thanh Bùi
Xem chi tiết
Duy Thanh Bùi
Xem chi tiết
Phía sau một cô gái
20 tháng 3 2023 lúc 19:57

program SoHoanHao;

uses crt;

var

     i, j, n, s: integer;

begin

     clrscr;

     write('Nhap n: ');

     readln(n);

     for i := 1 to n do

     begin

          s := 0;

          for j := 1 to i - 1 do

          begin

               if i mod j = 0 then

                    s := s + j;

               end;

               if s = i then

                    writeln(i);

     end;

     readln;

end.

Bình luận (0)
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.

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)
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)
Nhật Tiên
Xem chi tiết
Bùi Anh Tuấn
1 tháng 4 2021 lúc 19:42

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)
ngocanh
Xem chi tiết
ngocanh
1 tháng 12 2021 lúc 22:08

giúp em với

 

Bình luận (0)
Trần Minh Tâm
1 tháng 12 2021 lúc 22:33

Câu 3:

program cauba;

int chieudai, chieurong, chuvi, dientich :real;

begin

write('Chieu dai la: '); Readln(chieudai);

write('Chieu rong la: '); Readln(chieurong);

chuvi = (chieudai + chieu rong)*2;

dientich= chieudai*chieurong;

writeln('Chu vi la: ',chuvi);

writeln('Dien tich la: ',dientich);

end.

 

Bình luận (0)
Trần Minh Tâm
1 tháng 12 2021 lúc 22:33

Caua1:

program caumot;

begin

writeln('lop 8A chao ban!');

end.

Câu 2:

program cauhai;

int a,b,c :real;

begin

write('a='); readln(a);

write('b='); readln(b);

c= a+b;

write('Tong hai so a b la:',c);

end.

Bình luận (0)