Program HelloWorld output var integer function num_of_frac real intege

 1
 2
 3
 4
 5
 6
 7
 8
 9
10
11
12
13
14
15
16
17
18
19
Program HelloWorld(output);
var b: integer;
function num_of_frac(s: real): integer;
var i: integer;
begin
i := 0;
while i < 10 do begin
if frac(s) > 0 then begin
s := s * 10;
i := i + 1;
end else break;
end;
num_of_frac := i;
end;
begin
writeln(num_of_frac(3.3333):2);
end.