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 x,n,d,i:longint;
st,st1:string;
a:integer;
{----------------------chuong-trinh-con-tim-ucln---------------------}
function ucln(a,b:longint):longint;
var t:longint;
begin
t:=b mod a;
while t<>0 do
begin
t:=a mod b;
a:=b;
b:=t;
end;
ucln := a;
end;
{-------------------chuong-trinh-chinh-----------------}
begin
clrscr;
write('nhap x='); readln(x);
str(x,st);
d:=length(st);
st1:='';
for i:=d downto 1 do
st1:=st1+st[i];
val(st1,n,a);
if ucln(x,n)=1 then writeln('Phai')
else writeln('khong phai');
readln;
end.
uses crt;
var i,n,t,j,kt:integer;
begin
clrscr;
readln(n);
t:=0;
for i:=2 to n do
if n mod i=0 then
begin
kt:=0;
for j:=2 to trunc(sqrt(i)) do
if i mod j=0 then kt:=1;
if kt=0 then t:=t+i;
end;
write(t);
readln;
end.
uses crt;
var a,b,l,r,i,dem:integer;
begin
clrscr;
readln(a,b,l,r);
dem:=0;
for i:=l to r do
if (i mod a=0) and (i mod b=0) then inc(dem);
write(dem);
readln;
end.
var a,b,dem,L,i,R:longint;
begin
readln(a,b,L,R);
dem:=0;
for i:=L to R do
if (i mod a=0) and (i mod b=0) then inc(dem);
write(dem);
readln;
end.
#include <bits/stdc++.h>
using namespace std;
long long a,b,c;
int main()
{
cin>>a>>b>>c;
if (a+c %2==0) cout<<"AC ";
if (b+c%2==0) cout<<"BC ";
if (a+b%2==0) cout<<"AB";
return 0;
}
uses crt;
Var i,n,dem:integer;
a: array[1..1000] of integer;
Begin
clrscr;
Write('Nhap do dai cua day: ');readln(n);
dem:=0;
for i:= 1 to n do
Begin
write('So thu ',i,' = ');
readln(a[i]);
if a[i] mod 2 = 0 then inc(dem);
end;
Writeln('Day so co ',dem,' so chan');
readln;
End.
program abcdef;
uses Crt;
var
k, lowerLimit, upperLimit, i, j, reversed, temp, remainder: integer;
isPrime, isPalindrome: boolean;
begin
clrscr;
write('Nhap so chu so k (1<=k<=9): ');
readln(k);
lowerLimit := 1;
for i := 1 to k - 1 do
lowerLimit := lowerLimit * 10;
upperLimit := lowerLimit * 10 - 1;
writeln('Cac so nguyen to doi xung co ', k, ' chu so la:');
for i := lowerLimit to upperLimit do
begin
// Kiểm tra số nguyên tố
isPrime := True;
if i < 2 then
isPrime := False
else
for j := 2 to trunc(sqrt(i)) do
if i mod j = 0 then
beginisPrime := False;break;end;
// Kiểm tra số đối xứng
if isPrime then
begin
reversed := 0;
temp := i;
while temp <> 0 dobeginremainder := temp mod 10;
reversed := reversed * 10 + remainder;
temp := temp div 10;
end;
isPalindrome := (i = reversed);
if isPalindrome then
writeln(i);
end;
end;
readln;
end.
Program HOC24;
var x: integer;
begin
write('Nhap so: '); readln(x);
if x div 1000=1 then write('Mot nghin ');
if x div 1000=2 then write('Hai nghin ');
if x div 1000=3 then write('Ba nghin ');
if x div 1000=4 then write('Bon nghin ');
if x div 1000=5 then write('Nam nghin ');
if x div 1000=6 then write('Sau nghin ');
if x div 1000=7 then write('Bay nghin ');
if x div 1000=8 then write('Tam nghin ');
if x div 1000=9 then write('Chin nghin ');
if x div 1000<>0 then
if x div 100=0 then write('khong tram ');
if x div 100=1 then write('mot tram ');
if x div 100=2 then write('hai tram ');
if x div 100=3 then write('ba tram ');
if x div 100=4 then write('bon tram ');
if x div 100=5 then write('nam tram ');
if x div 100=6 then write('sau tram ');
if x div 100=7 then write('bay tram ');
if x div 100=8 then write('tam tram ');
if x div 100=9 then write('chin tram ');
if (x div 1000<>0) or (x div 100<>0) then
begin
if (x div 10<>0) then
begin
if x div 10=1 then write('muoi ');
if x div 10=2 then write('hai muoi ');
if x div 10=3 then write('ba muoi ');
if x div 10=4 then write('bon muoi ');
if x div 10=5 then write('nam muoi ');
if x div 10=6 then write('sau muoi ');
if x div 10=7 then write('bay muoi ');
if x div 10=8 then write('tam muoi ');
if x div 10=9 then write('chin muoi ');
if x mod 10=1 then write('mot');
if x mod 10=2 then write('hai');
if x mod 10=3 then write('ba');
if x mod 10=4 then write('bon');
if x mod 10=5 then write('lam');
if x mod 10=6 then write('sau');
if x mod 10=7 then write('bay');
if x mod 10=8 then write('tam');
if x mod 10=9 then write('chin');
end else
begin
if x mod 10=1 then write('le mot');
if x mod 10=2 then write('le hai');
if x mod 10=3 then write('le ba');
if x mod 10=4 then write('le tu');
if x mod 10=5 then write('le nam');
if x mod 10=6 then write('le sau');
if x mod 10=7 then write('le bay');
if x mod 10=8 then write('le tam');
if x mod 10=9 then write('le chin');
end;
readln
end.
uses crt;
var n,d,kt,i,b:integer;
st:string;
a:array[1..100]of integer;
begin
clrscr;
write('nhap n='); readln(n);
str(n,st);
d:=length(st);
kt:=0;
for i:=1 to d do
val(st[i],a[i],b);
for i:=1 to d do
if a[i]>1 then
begin
kt:=1;
writeln('ban da nhap sai, yeu cau ban nhap lai');
end;
if kt=0 then
begin
if n mod 3=0 then writeln('thoa man')
else writeln('khong thoa man');
end;
readln;
end.