+0  
 
0
33
1
avatar

The sum of all the digits used to write the whole numbers 10 through 13 is 1+0+1+1+1+2+1+3 = 10. What is the sum of all the digits used to write the whole numbers 1 through 400, inclusive?

 Jun 21, 2022
 #1
avatar
0

n=1;a=400;s=0;m=n;p=0;n=m;cycle:s=s+(n%10);p=p+1;n=(n div 10);if(n!=0, goto cycle,0);m=m+1;if(m<=a, goto5,0);print"Total Sum =",s;print"Total Num =",p

 

 

Total Sum = 4204
Total Num = 1092

 Jun 22, 2022

11 Online Users

avatar