Những câu hỏi liên quan
Gà Công Nghệ
Xem chi tiết
Anh Phạm
28 tháng 8 2021 lúc 19:43

uses crt;

var n,i,o,d:integer;

function ktnt(n:integer): integer;

var i,d:integer;

begin

d:=0;

for i:=1 to sqrt(n) do

if (n mod i=0) then d:=d+1;

if d=2 then ktnt=0

else ktnt=1;

end;

begin

readln(n);

writeln(' so nguyen to be hon hoac bang n la'); {a}

for i:=1 to n do

if ktnt(i)=0 then writeln(i);

writeln('so nguyen to nho nhat khong be hon n');

o:=n;

while o>0 do

begin

if ktnt(o)=0 then

begin

write(o);

break;

end;

o:=o+1;

end;

writeln('cặp số nguyên tố là hai số nguyên lẻ liên tiếp nhỏ hơn hoặc bằng n');

o:=0;

o:=1;

d:=0;

for i:=o+2 to n do

begin

if ktnt(i)=0 then

begin

d:=d+1;

write(i,' ');

if d<2 then continue;

end;

d:=0;

writeln;

end;

readln;

end.

Bình luận (1)
Lê Tâm Anh
Xem chi tiết
gấu béo
7 tháng 5 2023 lúc 19:20

program Le_Nho_Hon_Hoac_Bang_n;

uses crt;

var

       n, i: integer;

begin

       clrscr;

       write('Nhap vao mot so nguyen duong n: ');

       readln(n);

       while n <= 0 do

       begin

              writeln('So ban nhap khong hop le. Xin vui long nhap lai: ');

              readln(n);

       end;

       clrscr;

       writeln('Cac so le nho hon hoac bang ', n, ' la:');

       i := 1;

       while i <= n do

       begin

              if i mod 2 <> 0 then

                     writeln(i);

              i := i + 1;

       end;

       readln;

end.

Bình luận (0)
Phạm Thị Đông Nhi_HDI
Xem chi tiết
shitbo
21 tháng 6 2020 lúc 16:54

program hello;

uses crt;

Var n,i,j,k: integer;

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

begin;

a[1]:=k;

Readln(n);

For i:=1 to n do

Begin;

Writeln('nhap a[',i,'] '); Readln(a[i]);

End;

For i:=1 to n-1 do

For j:=i+1 to n do

If a[i]<a[j] then k:=a[j];

Writeln('gia tri lon nhat la', k);

end.

Bình luận (0)
 Khách vãng lai đã xóa
hùng tín trang
Xem chi tiết
Nguyễn Lê Phước Thịnh
14 tháng 3 2022 lúc 9:47

Bài 3: 

#include <bits/stdc++.h>

using namespace std;

long long x,n,i;

int main()

{

cin>>n;

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

{

x=int(sqrt(i));

if (x*x==i) cout<<i<<" ";

}

return 0;

return 0;

}

Bình luận (0)
Bé Kunz
Xem chi tiết
Nguyễn Lê Phước Thịnh
21 tháng 3 2021 lúc 22:24

Bài 1: 

uses crt;

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

i,n,t:integer;

begin

clrscr;

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

for i:=1 to n do 

begin

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

end;

t:=0;

for i:=1 to n do 

  if a[i] mod 5=0 then t:=t+a[i];

writeln('Tong cac so chia het cho 5 la: ',t);

readln;

end.

Bình luận (0)
Nguyễn Lê Phước Thịnh
21 tháng 3 2021 lúc 22:25

Bài 2: 

uses crt;

var st:string;

d,i:integer;

begin

clrscr;

write('Nhap xau:'); readln(st);

d:=length(st);

for i:=1 to d do 

  if st[i]=#32 then delete(st,i,1);

writeln(st);

readln;

end.

Bình luận (0)
scar titan
28 tháng 7 2021 lúc 10:11

python có ko bạn

 

Bình luận (0)
Linh Đan
Xem chi tiết
Võ Đức Dũng
17 tháng 9 2021 lúc 21:33

câu 1

Program Nguyen_to;

Var n,i:integer;

Function NT(n:integer):Boolean;

Var ok: Boolean;

i: integer;

Begin ok:=true;

for i:=2 to n-1 do if (n mod i)= 0 then ok:=ok and false;

if n < 2 then NT:=false else NT:=ok;

End;

Begin Write('Nhap n: ');

Readln(n); i:=n;

Repeat i:=i+1;

Until NT(i);

Write('So nguyen to nho nhat lon hon ',n, 'la: ',i);

Readln End.

Bình luận (1)
Võ Đức Dũng
17 tháng 9 2021 lúc 21:39

câu 2

uses crt;

const so: set of char=['0','1','2','3','4','5','6','7','8','9'];

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

st,b:string;

c,l,i,n,j:integer;

s, Max: integer;

begin clrscr;

write('Nhap xau:');

readln(st);

l:=length(st);

i:=1;

n:=0;

repeat if (st[i] in so) then begin b:=''

repeat b:=b+st[i];

inc(i);

until (not(st[i] in so)) or (i>l);

inc(n);

val(b,a[n],c);

end;

inc(i);

until i>l;

Max:=a[1];

for i:=2 to n do If Max<A[i] Then Max:=A[i];

Writeln('Phan tu lon nhat cua mang:', Max);

readln;

end.

Bình luận (0)
Phan Thị Phương Thy
Xem chi tiết
Nguyễn Lê Phước Thịnh
28 tháng 4 2021 lúc 19:03

uses crt;

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

i,n,max,min:integer;

begin

clrscr;

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

for i:=1 to n do 

  begin

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

end;

max:=a[1];

min:=a[1];

for i:=1 to n do 

  begin

if max<a[i] then max:=a[i];

if min>a[i] then min:=a[i];

end;

writeln('So lon nhat la: ',max);

writeln('So nho nhat la: ',min);

readln;

end.

Bình luận (0)
Minh Lệ
28 tháng 4 2021 lúc 20:26

Program HOC24;

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

i,max,min,n: integer;

begin

write('Nhap so phan tu N: '); readln(N);

for i:=1 to n do

begin

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

end;

max:=a[1]; min:=a[1];

for i:=1 to n do

begin

if a[i]>max then max:=a[i];

if a[i]<min then min:=a[i];

end;

writeln('So nho nhat la :',max);

write('So lon nhat la: ',min);

readln

end.

Bình luận (0)
Đoàn Khánh Chi
Xem chi tiết
Đỗ Thanh Tuyến
6 tháng 5 2021 lúc 23:54

1. uses crt;
var a,vt:array[1..100]of integer;
n,i,t,dem:integer;
begin
clrscr;
write('Nhap n='); readln(n);
for i:=1 to n do
begin
repeat
write('A[',i,']='); readln(a[i]);
until a[i]>=0;
end;
t:=0;
for i:=1 to n do
begin
if t<100 then
begin
t:=t+a[i];
dem:=dem+1;
vt[dem]:=i;
end;
end;
writeln(vt[dem]);
readln;
end.

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

Câu 2: 

uses crt;

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

i,n,kt:integer;

begin

clrscr;

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

for i:=1 to n do 

  begin

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

end;

kt:=0;

for i:=1 to n-1 do 

if a[i]>=a[j] then kt:=1;

if kt=0 then writeln('Day la day so khong giam')

else writeln('Day khong la day so khong giam');

readln;

end.

Bình luận (0)
võ nguyên đức anh
12 tháng 4 2023 lúc 20:27

hi

Bình luận (0)
lân đinh
Xem chi tiết
Nguyễn Lê Phước Thịnh
11 tháng 5 2021 lúc 10:50

Bài 3:

uses crt;

var i:integer;

{------------------chuong-trinh-con-kiem-tra-so-nguyen-to----------------------}

function ktnt(x:integer):boolean;

var kt:boolean;

i:integer;

begin

kt:=true;

for i:=2 to x-1 do

  if x mod i=0 then kt:=false;

if kt=true then ktnt:=true

else ktnt:=false;

end;

{-------------------------chuong-trinh-chinh----------------------------}

begin

clrscr;

for i:=2 to 9999 do 

  if (ktnt(i)=true) and (ktnt(i+2)=true) then 

begin

writeln(i,',',i+2);

delay(500);

end;

readln;

end.

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

Bài 4: 

uses crt;

var a,b,c,kt:integer;

begin

clrscr;

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

write('Nhap thang:'); readln(b);

write('Nhap nam:'); readln(c);

kt:=0;

if (b=1) and (0<a) and (a<=31) then kt:=1;

if (b=2) and (0<a) and (a<=28) then kt:=1;

if (b=2) and (0<a) and (a<=29) and (c mod 4=0) then kt:=1;

if (b=3) and (0<a) and (a<=31) then kt:=1;

if (b=4) and (0<a) and (a<=30) then kt:=1;

if (b=5) and (0<a) and (a<=31) then kt:=1;

if (b=6) and (0<a) and (a<=30) then kt:=1;

if (b=7) and (0<a) and (a<=31) then kt:=1;

if (b=8) and (0<a) and (a<=31) then kt:=1;

if (b=9) and (0<a) and (a<=30) then kt:=1;

if (b=10) and (0<a) and (a<=31) then kt:=1;

if (b=11) and (0<a) and (a<=30) then kt:=1;

if (b=12) and (0<a) and (a<=31) then kt:=1;

if kt=0 then writeln('Khong hop le')

else writeln('Hop le');

readln;

end.

Bình luận (0)
Lê Thị Cẩm Tiên
9 tháng 7 2021 lúc 10:30

Bạn ơi bạn làm ra bài 3 chưa, cho mình xin cách làm nữa.

Python

Bình luận (0)