Here is the code:
{A positive integer N is called a " fair " if it is divisible by each of its digits.
For example, the number 132 is fair , because it is divisible by 1 , 3 and 2.
In contrast the number 123 is not fair, since , although divisible by 1 and 3 but
not divisible by 2. Write a function that determines whether a fair number N
( N the parameter is a function). Next, write a program which uses this function
finds and displays all the honest numbers range from A to B, including
( value of A, B will be awarded to the entry of the program - are positive integers
from the range of data type integer.}
var
i :integer;
n1, n2 :integer;
s :string;
IsFair :boolean;
begin
IsFair := False;
for i := 1 to Length(Edit1.Text) do
begin
if TryStrtoInt(Edit1.Text, n1) and TryStrtoInt(Edit1.Text[i], n2) then
begin
IsFair := True;
if n1 mod n2 <> 0 then
begin
IsFair := False;
Break;
end;
end;
end;
if IsFair then
ShowMessage('Is Fair')
else
ShowMessage('Is Not Fair');
end;