+0  
 
0
41
2
avatar

If you randomly drew a number between 1 and 100,000, what is the probability that its digits sum up to a number from 22 to 24?

 Feb 6, 2021
 #1
avatar
+1

a=0;b=0;c=0;d=0;e=0;f=0;p=0; cycle:n=b*10000+c*1000+d*100+e*10+f; if(a+b+c+d+e+f==22 or a+b+c+d+e+f==23 or a+b+c+d+e+f==24, goto loop, goto next);loop:printn," ",;p=p+1; next:f++;if(f<10, goto cycle, 0);f=0;e++;if(e<10, goto cycle, 0);f=0;e=0;d++;if(d<10, goto cycle,0);f=0;e=0;d=0;c++;if(c<10, goto cycle,0);f=0;e=0;d=0;c=0;b++;if(b<10, goto cycle,0);f=0;e=0;d=0;c=0;b=0;a++;if(a==0, goto cycle,0);print"Total = ",p

 

OUTPUT ==17,875 integers whose digits sum up to 22, 23 and 24. Therefore, the probability is:

17,875 / 100,000 =17.875%

 Feb 6, 2021
 #2
avatar+112513 
0

Is this meant to be a computing question or a maths question?

 Feb 6, 2021

20 Online Users

avatar