Bài 28:
program bai_giai;
uses crt;
var n:longint;
function vtnhonhat(k:longint):byte;
var min,a,vt,d:longint;
begin
min:=9; d:=0;
while k<>0 do
begin
a:=k mod 10;
if (a<>0) and (a<=min) then
begin
min:=a;
vt:=d;
end;
k:=k div 10;
d:=d+1;
end;
exit(vt);
end;
BEGIN
clrscr;
write('Nhap n: '); readln(n);
write(vtnhonhat(n));
readln;
END.
Bài 29:
program bai_giai;
uses crt;
var n:longint;
function max(k:longint):byte;
var a,ln:byte;
begin
ln:=k mod 10; k:=k div 10;
while k<>0 do
begin
a:=k mod 10;
if a>ln then ln:=a;
k:=k div 10;
end;
exit(ln);
end;
function min(k:longint):byte;
var a,nn:byte;
begin
nn:=k mod 10; k:=k div 10;
while k<>0 do
begin
a:=k mod 10;
if a<nn then nn:=a;
k:=k div 10;
end;
exit(nn);
end;
BEGIN
clrscr;
write('Nhap n: '); readln(n);
write(max(n)-min(n));
readln;
END.
Bài 30:
program bai_giai;
uses crt;
var n:longint;
function ktdx(k:longint):boolean;
var k1,so:longint;
a:byte;
begin
k1:=k; so:=0;
while k1<>0 do
begin
a:=k1 mod 10;
so:=so*10+a;
k1:=k1 div 10;
end;
if so=k then ktdx:=true else ktdx:=false;
end;
BEGIN
clrscr;
write('Nhap n: '); readln(n);
write(ktdx(n));
readln;
END.
uses crt;
var n:longword;
function solve(n:longword):byte;
var v,min,d:byte;
begin
v:=0;min:=9;d:=0;
while n<>0 do
begin
if n mod 10 <> 0 then
if n mod 10 <= min then
begin
min:=n mod 10;
v:=d;
end;
inc(d);n:=n div 10;
end;
exit(v);
end;
begin
clrscr;
readln(n);
writeln(solve(n));
readkey;
end.
==============================
uses crt,math;
var n:longword;
function solve(n:longword):byte;
var mi,ma,m:byte;
begin
mi:=9;ma:=0;
while n<>0 do
begin
m:=n mod 10;
mi:=min(mi,m);
ma:=max(ma,m);
n:=n div 10;
end;
exit(ma-mi);
end;
begin
clrscr;
readln(n);
writeln(solve(n));
readkey;
end.
===============================
uses crt;
var n:longword;
function solve(n:longword):boolean;
var i:byte;
s:string;
begin
str(n,s);
for i:=1 to length(s) div 2 do
if s[i] <> s[length(s)-i+1] then exit(false);
exit(true);
end;
begin
clrscr;
readln(n);
writeln(solve(n));
readkey;
end.
Tin học, tiếng Anh: informatics, tiếng Pháp: informatique, là một ngành khoa học chuyên nghiên cứu quá trình tự động hóa việc tổ chức, lưu trữ, xử lý và truyền dẫn thông tin của một hệ thống máy tính cụ thể hoặc trừu tượng (ảo). Với cách hiểu hiện nay, tin học bao hàm tất cả các nghiên cứu và kỹ thuật có liên quan đến việc mô phỏng, biến đổi và tái tạo thông tin.
Nguồn : Wikipedia - Bách khoa toàn thưLớp 8 - Năm thứ ba ở cấp trung học cơ sở, học tập bắt đầu nặng dần, sang năm lại là năm cuối cấp áp lực lớn dần nhưng các em vẫn phải chú ý sức khỏe nhé!
Nguồn : ADMIN :))Xem thêm tại https://loigiaisgk.com/cau-hoi or https://giaibtsgk.com/cau-hoi
Copyright © 2021 HOCTAPSGK