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.
010010110101011010101001001001011010111101000111001010101101010010101011011101001011010101000100101001011010101101010100100100101101011110100011100101010110101001010101101110100101101010100010010100101101010110101010010010010110101111010001110010101011010100101010110111010010110101010001001010010110101011010101001001001011010111101000111001010101101010010101011011101001011010101000100101001011010101101010100100100101101011110100011100101010110101001010101101110100101101010100010010100101101010110101010010010010110101111010001110010101011010100101010110111010010110101010001001010010110101011010101001001001011010111101000111001010101101010010101011011101001011010101000100101001011010101101010100100100101101011110100011100101010110101001010101101110100101101010100010010100101101010110101010010010010110101111010001110010101011010100101010110111010010110101010001001010010110101011010101001001001011010111101000111001010101101010010101011011101001011010101000100101001011010101101010100100100101101011110100011100101010110101001010101101110100101101010100010010100101101010110101010010010010110101111010001110010101011010100101010110111010010110101010001001010010110101011010101001001001011010111101000111001010101101010010101011011101001011010101000100101001011010101101010100100100101101011110100011100101010110101001010101101110100101101010100010010100101101010110101010010010010110101111010001110010101011010100101010110111010010110101010001001010010110101011010101001001001011010111101000111001010101101010010101011011101001011010101000100101001011010101101010100100100101101011110100011100101010110101001010101101110100101101010100010010100101101010110101010010010010110101111010001110010101011010100101010110111010010110101010001001
Bài 1:
uses crt;
var n,kt,i,n1,i1:integer;
begin
clrscr;
write('nhap n='); readln(n);
if n>=0 then
begin
write(n,'=');
n1:=n;
i1:=2;
repeat
while n1 mod i1<>0 do
i1:=i1+1;
write(i1);
n1:=n1 div i1;
if n1>1 then write('*');
until n1=1;
end
else writeln('vui long nhap so tu nhien');
readln;
end.
Bài 2:
uses crt;
var n,d,i,x,t,ln:integer;
st:string;
a:array[1..100]of integer;
begin
clrscr;
write('nhap n='); readln(n);
if n>0 then
begin
str(n,st);
d:=length(st);
for i:=1 to d do
val(st[i],a[i],x);
t:=0;
for i:=1 to d do
t:=t+a[i];
writeln('tong cac chu so cua so ',n,' la: ',t);
writeln('so ',n,' co ',d,' chu so');
ln:=0;
for i:=1 to d do
if ln<a[i] then ln:=a[i];
writeln('chu so lon nhat cua so ',n,' la: ',ln);
end
else writeln('vui long nhap lai');
readln;
end.
Bài 3:
uses crt;
var n,i,dem,ln:integer;
a:array[1..100]of integer;
begin
clrscr;
write('nhap n='); readln(n);
ln:=0;
for i:=n div 2 downto 1 do
if n mod i=0 then if (i mod 2=1) and (ln<i) then ln:=i;
writeln(ln);
readln;
end.
Bài 4:
uses crt;
var n,i,d,x,nn,dem:integer;
st:string;
a,b: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);
for i:=1 to d do
if a[i] mod 2=0 then
begin
dem:=dem+1;
b[dem]:=a[i];
end;
nn:=b[1];
for i:=1 to dem do
if nn>b[i] then nn:=b[i];
writeln('so chan be nhat trong so ',n,' la: ',nn);
readln;
end.
Bài 5:
uses crt;
var n,d,i:integer;
st:string;
begin
clrscr;
write('nhap n='); readln(n);
str(n,st);
d:=length(st);
for i:=d downto 1 do
write(st[i]);
readln;
end.
Bài 6:
uses crt;
var n:integer;
st:string;
begin
clrscr;
write('nhap n='); readln(n);
str(n,st);
writeln('so dau tien tinh tu trai qua phai cua so ',n,' la: ',st[1]);
readln;
end.
bài 1:
var i,n : integer;
writeln('nhap n');
readln(n);
for i:=1 to 100 do
s:=s+i;
writeln('tong la",s);
readln;
end.
bài 2:
var n:real;
begin
writeln('nhap n');
if n (mod 2=0) and (n mod 3=0) then
writeln('chia het roi')
else writeln(khong chia het');
readln;
end.
Bài 1:
uses crt;
var i:byte;
begin
clrscr;
for i:=1 to 50 do
write('*');
readln;
end.
Bài 2:
uses crt;
var i,j:byte;
begin
clrscr;
for i:=1 to 10 do
begin
for j:=1 to 50 do
write('*');
writeln;
end;
readln;
end.
bài 1:
uses crt;
var n,s:integer;
i:longint;
begin
clrscr;
readln(n);
for i:=1 to n do
s:=s+(1*i);
writeln(s);
readln
end.
bài 2:
uses crt; var x,y,ucln,t:integer; begin clrscr; readln(x,y);t:=x*y; While x<>y do If x>y then x:=x-y else y:=y-x;
ucln:=x;
t:=t div ucln; writeln(ucln);
readln
end.
bài 5:
uses crt;
var s,n:integer
i:longint;
begin
clrscr;
readln(n);
s:=0;
for i:=1 to n do
s:=s+i*2;
writeln(s);
readln
end.
2.
Hình chữ nhật:
* * * * * * * * * *
* *
* *
* * * * * * * * * *
Hình tam giác:
*
* *
* * * * * * * * * *
Bài 1:
uses crt;
var n,i,t:integer;
begin
clrscr;
write('n='); readln(n);
t:=0;
i:=1;
while i<=n do
begin
t:=t+i;
i:=i+1;
end;
writeln('tong cac so nguyen tu 1 toi ',n,' la: ',t);
readln;
end.
Bài 2:
uses crt;
var n,t:longint;
begin
clrscr;
t:=0;
repeat
write('n='); readln(n);
t:=t+n;
until n=0;
writeln('tong cac so nguyen nhap tu ban phim la: ',t);
readln;
end.
Bài 3:
uses crt;
var d,i,t,n,x:longint;
a:array[1..100]of longint;
st:string;
begin
clrscr;
write('n='); readln(n);
str(n,st);
d:=length(st);
t:=0;
for i:=1 to d do
begin
val(st[i],a[i],x);
t:=t+a[i];
end;
writeln('tong cac chu so cua ',n,' la: ',t);
readln;
end.
Câu 1:
uses crt;
var n,i:integer;
tong:longint;
begin
clrscr;
write('Nhap n: ');readln(n);
i:= 0;
while i < n do
begin
i:= i + 1;
tong:= tong + i;
end;
write('Tong cac so tu 1 den ',n,'la: ',tong);
readln
end.
Câu 2:
uses crt;
var i,a:integer;
tong:longint;
begin
clrscr;
a:= 1; i:= 1; tong:= 0;
while a <> 0 do
begin
write('Nhap phan tu thu ',i,': ');
readln(a);
i:= i + 1;
tong:= tong + a;
end;
write('Tong cac so = ',tong);
readln
end.
Câu 3:
uses crt;
var n,luu,tong: integer;
begin
clrscr;
write('Nhap so N: ');readln(n);
luu:= n; tong:= n mod 10;
while (n div 10 > 0) do
begin
n:= n div 10;
tong:= tong + (n mod 10);
end;
write('Tong cac chu so cua so ',luu,' la: ',tong);
readln
end.
hì