+0  
 
0
401
1
avatar

How many of the integers 0, 1, 2, . . . , 999 are neither divisible by 9 nor contain the digit 9?

 Nov 25, 2019
 #1
avatar
+1

n=0;p=0;cycle: a=(1+n);b=int(a/100)%10;c=int(a/10)%10;d=a%10; n++;if(a%9!=0 and b!=9 and c!=9 and d!=9,  goto loop, goto cycle);loop:p=p+1;printa,"  ",;if(n<=810, goto cycle, discard=0;print"Total = ",p

 

OUTPUT = 648 such numbers.

 Nov 25, 2019
edited by Guest  Nov 25, 2019

0 Online Users