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,t:int64;
begin
clrscr;
repeat
write('Nhap n='); readln(n);
until (0<n) and (n<1000000000);
t:=0;
for i:=1 to n-1 do
if n mod i=0 then t:=t+i;
if t=n then writeln(n,' la so hoan hao')
else writeln(n,' khong la so hoan hao');
readln;
end.
uses crt;
var a,b:longint;
Begin
clrscr;
Writeln('Nhap a,b=');
Readln(a,b);
writeln('tich hai so la : a*b=',a*b);
writeln('thuong hai so la :a/b=',a/b);
Readln;
End.
uses crt;
var a,i,s:longint;
begin
clrscr;
write('a='); readln(a);
s:=0;
for i:=1 to a do
begin
if i mod 2=1 then s:=s+i
else s:=s-i;
end;
writeln('Ket qua la: ',s);
readln;
end.
uses crt;
var n,t:int64;
dem,i:integer;
begin
clrscr;
repeat
write('nhap n='); readln(n);
until (0<n) and (n<1000000000);
writeln('Cac so chinh phuong trong khoang tu 1 toi ',n,' la: ');
dem:=0;
t:=0;
for i:=1 to n do
if sqrt(i)=trunc(sqrt(i)) then
begin
write(i:6);
inc(dem);
t:=t+i;
end;
writeln;
writeln('So so chinh phuong trong khoang tu 1 toi ',n,' la: ',dem);
writeln('Tong cac so chinh phuong trong khoang tu 1 toi ',n,' la: ',t);
readln;
end.
Program hotrotinhoc;
var i,n,s,k,max,n1: longint;
begin
write('Nhap N='); readln(n);
max:=0; n1:=n;
while n<>0 do
begin
k:=n mod 10;
s:=s*10+k;
n:=n div 10;
if k>max then max:=k;
end;
writeln('Chu so lon nhat cua so tu nhien vua nhap la :',max);
If s=n1 then write('La so doi xung') else write('Khong phai so doi
xung');
readln
end.
uses crt;
var n,i,d,x,ln,kt:word;
st:string;
a:array[1..100]of integer;
begin
clrscr;
write('nhap n='); readln(n);
str(n,st);
d:=length(st);
for i:=1 to d do
val(st[i],a[i],x);
ln:=0;
for i:=1 to d do
if ln<a[i] then ln:=a[i];
writeln('chu so lon nhat trong so ',n,' la: ',ln);
{-----------------------kiem-tra-doi-xung----------------------------}
kt:=0;
for i:=1 to d do
if a[i]<>a[d+1-i] then kt:=1;
if kt=0 then writeln('day la so doi xung')
else writeln('day khong la so doi xung');
readln;
end.
Program HOC24;
var a: array[1..10] of integer;
i,n,d,j: integer;
function ucln(x,y: integer): integer;
var t: integer;
begin
while y<>0 do
begin
t:=x mod y;
x:=y;
y:=t;
end;
ucln:=x;
end;
begin
write('Nhap N='); readln(n);
for i:=1 to n do
begin
write('a[',i,']='); readln(a[i]);
end;
d:=0;
for i:=1 to n do
for j:=i to n do
if ucln(a[i],a[j])=1 then d:=d+1;
write('Co ',d,' cap so nguyen to cung nhau');
readln
end.
uses crt;
var a:array[2..1000000]of longint;
n,i,k,t,dem:longint;
begin
clrscr;
repeat
write('Nhap n='); readln(n);
until (1<n) and (n<=1000000);
for i:=2 to n do
begin
write('A[',i,']='); readln(a[i]);
end;
write('Nhap k='); readln(k);
t:=0;
dem:=0;
for i:=2 to n do
if a[i] mod k=0 then
begin
t:=t+a[i];
inc(dem);
end;
writeln('Tong cac so chia het cho ',k,' la: ',t);
writeln('So phan tu chia het cho ',k,' la: ',dem);
readln;
end.
uses crt;
var a,b,i,bcnn,ucln:integer;
begin
clrscr;
repeat
write('Nhap a='); readln(a);
write('Nhap b='); readln(b);
until (a<>0) and (b<>0);
writeln('Uoc chung cua ',a,' va ',b,' la: ');
if a<b then
begin
for i:=1 to a do
if (a mod i=0) and (b mod i=0) then write(i:4);
end;
if a>b then
begin
for i:=1 to b do
if (a mod i=0) and (b mod i=0) then write(i:4);
end;
if a=b then
begin
for i:=1 to a do
if (a mod i=0) and (b mod i=0) then write(i:4);
end;
writeln;
bcnn:=a*b;
for i:=a*b downto 1 do
if (i mod a=0) and (i mod b=0) then
begin
if bcnn>i then bcnn:=i;
end;
writeln('Boi chung nho nhat cua ',a,' va ',b,' la: ',bcnn);
ucln:=1;
for i:=1 to a*b do
if (a mod i=0) and (b mod i=0) then
begin
if ucln<i then ucln:=i;
end;
writeln('Uoc chung lon nhat cua ',a,' va ',b,' la: ',ucln);
readln;
end.
uses crt;
var n,i:longint;
kt:boolean;
begin
clrscr;
readln(n);
if (n<2) then writeln('Nhap lai')
else
begin
kt:=true;
for i:=2 to trunc(sqrt(n)) do
if n mod i=0 then
begin
kt:=false;
break;
end;
if kt=true then writeln('la so nguyen to')
else writeln('khong la so nguyen to');
end;
readln;
end.
em cảm ơn cô rất nhiều!!!
Program HOC24;
var i,a,b: longint;
d: byte;
function t(x: longint): longint;
var j,t1: longint;
begin
t1:=0;
for j:=1 to x do if x mod j=0 then t1:=t1+j;
t:=t1;
end;
begin
write('Nhap a='); readln(a);
write('Nhap b='); readln(b);
d:=0;
for i:=a to b do
if (t(i)/i)=12/5 then d:=d+1;
write(d);
readln
end.