RosettaCodeData/Task/Casting-out-nines/FutureBasic/casting-out-nines.basic

19 lines
400 B
Plaintext

_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