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 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.
var
i,n,a,s,d:integer;
s1:lonint;
begin
write(' nhap a : ); readln(a);
s1:=0;s:=0;
while a <> 0 then
begin
s:= s + a mod 10;
a:= a div 10;
n:= n +s;
inc(d);
if s1 = 0 then s1:= s1 + s else
s1:= s1 * 10 + s;
s:=0;
end;
writeln(' chu so :',d);
writeln(' tong : ',n);
write(' dao nguoc: ',s1);
readln
end.
1:
uses crt;
var i,j,t,kt:integer;
begin
clrscr;
t:=0;
for i:=1 to 100 do
if i>1 then
begin
kt:=0;
for j:=2 to i-1 do
if i mod j=0 then kt:=1;
if kt=0 then t:=t+i;
end;
writeln(t);
readln;
end.
Câu 2:
*Viết chương trình:
uses crt;
var n,p,t:integer;
begin
clrscr;
write('Nhap n='); readln(n);
t:=0;
for p:=2 to n-1 do
if n mod p=0 then t:=t+p;
writeln('Tong cac uoc that su cua ',n,' la: ',t);
readln;
end.
a)
uses crt;
var n,i,t,j:integer;
begin
clrscr;
write('Nhap n='); readln(n);
for i:=1 to n do
begin
t:=0;
for j:=1 to i-1 do
if i mod j=0 then t:=t+j;
if t=i then write(i:4);
end;
readln;
end.
b)
uses crt;
var gt:real;
i,n:integer;
begin
clrscr;
write('Nhap n='); readln(n);
gt:=1;
for i:=1 to n do
gt:=gt*i;
writeln(gt:0:0);
readln;
end.
uses crt;
var n,kt,snt,b,m:longint;
{-----------------------------}
procedure nhap(var a:longint);
begin
write('nhap n:'); readln(a);
end;
{-------------------------------------------}
function ktnt(var x:longint):integer;
var kt,i,kt1,j:integer;
begin
kt:=0;
for i:=2 to trunc(sqrt(x)) do
if x mod i=0 then
begin
kt:=1;
break;
end;
if kt=0 then ktnt:=1
else ktnt:=0;
end;
{-----------------------------------------------------}
BEGIN
clrscr;
nhap(n);
for m:=10 to n do
{-----------------------------------------------}
begin
begin
b:=m;
repeat
kt:=ktnt(b);
if kt=0 then break
else b:=b div 10;
until b<10;
if (ktnt(b)=1) and (b>1) then write(m,' ')
end;
end;
{-------------------------------------------------}
readln;
END.
uses crt;
var i,n:integer;
begin
clrscr;
readln(n);
for i:=1 to n do
if i mod 2=1 then write(i:4);
for i:=1 to n do
if i mod 2=0 then write(i:4);
readln;
end.