Hãy nhập câu hỏi của bạn vào đây, nếu là tài khoản VIP, bạn sẽ được ưu tiên trả lời.
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.
uses crt;
var a,b,i,x,y,n,m:integer;
st1,st2,st3,st4:string;
begin
clrscr;
write('Nhap a='); readln(a);
write('Nhap b='); readln(b);
str(a,st1);
str(b,st2);
st3:='';
for i:=length(st1) downto 1 do
st3:=st3+st1[i];
st4:='';
for i:=length(st2) downto 1 do
st4:=st4+st2[i];
val(st3,x,y);
val(st4,n,m);
writeln('So doi xung cua ',a,' la: ',x);
writeln('So doi xung cua ',b,' la: ',n);
writeln('Tong hai so doi xung cua ',a,' va ',b,' la: ',x+n);
readln;
end.
uses crt;
var a,b,c:integer;
begin
clrscr;
write('Nhap a='); readln(a);
write('Nhap b='); readln(b);
write('Nhap c='); readln(c);
if (a<b) and (b<c) then writeln('a<b<c');
if (a<c) and (c<b) then writeln('a<c<b');
if (b<c) and (c<a) then writeln('b<c<a');
if (b<a) and (a<c) then writeln('b<a<c')
if (c<a) and (a<b) then writeln('c<a<b');
if (c<b) and (b<a) then writeln('c<b<a');
readln;
end.
#include <bits/stdc++.h>
using namespace std;
long long n;
int main()
{
cin>>n;
if (n%2==0) cout<<"Chan";
else cout<<"Le";
return 0;
}
uses crt;
var a,b,i,x,y,n,m:integer;
st1,st2,st3,st4:string;
begin
clrscr;
write('Nhap a='); readln(a);
write('Nhap b='); readln(b);
str(a,st1);
str(b,st2);
st3:='';
for i:=length(st1) downto 1 do
st3:=st3+st1[i];
st4:='';
for i:=length(st2) downto 1 do
st4:=st4+st2[i];
val(st3,x,y);
val(st4,n,m);
writeln('So doi xung cua ',a,' la: ',x);
writeln('So doi xung cua ',b,' la: ',n);
writeln('Tong hai so doi xung cua ',a,' va ',b,' la: ',x+n);
readln;
end.
#include <bits/stdc++.h>
using namespace std;
long long a,b,x,y;
int main()
{
cin>>a>>b;
x=0;
while (a>0)
{
x=x*10+(a%10);
a=a/10;
}
cout<<x<<endl;
y=0;
while (b>0)
{
y=y*10+(b%10);
b=b/10;
}
cout<<y;
return 0;
}
program tong;
uses crt;
var M, N, S, i: integer;
begin
clrscr;
write ('Nhap M= '); readln(M);
write ('Nhap N= '); readln(N);
s : = 0;
for i := M to N do if (i mod 2 = 0) then s:= s + i;
write (T'ong cac so chan trong pham vi tu M den N = ',s);
readln;
end.
mk mới làm tổng thui nghen
uses crt;
var x,y,z,n : integer;
begin clrscr;
write('Nhap n:'); readln(n);
for x:=1 to 9 do
for y:=0 to 9 do
for z:=0 to 9 do
if n*(x+y+z) = x*100+y*10+z then
write('So thoa man de la :', x,y,z, ' ');
readln
end.
uses crt;
var a:array[1..5]of integer;
n,i,b,c,d,dem:integer;
begin
clrscr;
randomize;
n:=5;
for i:=1 to n do
begin
write('lan nhap thu ',i,'='); readln(a[i]);
end;
b:=random(900)+100;
c:=random(900)+100;
d:=random(900)+100;
dem:=0;
for i:=1 to n do
begin
if b=a[i] then inc(dem);
if c=a[i] then inc(dem);
if d=a[i] then inc(dem);
end;
if dem>=3 then writeln('ban da thang!')
else writeln('ban da thua!');
readln;
end.
uses crt;
var n,i,kt,j:longint;
begin
clrscr;
repeat
write('n='); readln(n);
if n<=2 then writeln('vui long nhap lai');
until n>2;
writeln('cac so nguyen to nho hon so ',n,' la: ');
for i:=2 to n do
begin
kt:=0;
for j:=2 to i-1 do
if i mod j=0 then kt:=1;
if kt=0 then write(i:4);
end;
readln;
end.
program cachkhac;
var i,N: integer;
function KT(a: integer): boolean;
var j: integer;
begin
nt:=false;
if j<=1 then exit;
for j:=2 to trunc(sqrt(a)) do if a mod j=0 then exit;
nt:=true;
end;
Begin
Write('Nhap so nguyen N=');
Readln(N);
For i:=1 to n do
If nt(i) then write(i,' ');
Readln
end.