RosettaCodeData/Task/Casting-out-nines/FutureBasic/casting-out-nines.basic
2023-07-01 13:44:08 -04:00

18 lines
400 B
Text

_base10 = 10
void local fn CastingOutNines
NSUInteger i, c1 = 0, c2 = 0
float percent
for i = 1 to _base10^2
c1++
if ( i mod ( _base10 -1 ) == ( i * i ) mod ( _base10 - 1 ) ) then c2++ : printf @"%d \b", i
next
print
percent = 100 -( 100 * c2 / c1 )
printf @"Trying %d numbers instead of %d numbers saves %.2f%%", c2, c1, percent
end fn
fn CastingOutNines
HandleEvents