+0  
 
0
99
2
avatar

Help I need help with this

 

Sam writes down the numbers 1, 2, 3, ..., 99

 

(a) How many digits did Sam write, in total?

(b) Sam chooses one of the digits written down, at random. What is the probability that Sam chooses a 0?

(c) What is the sum of all the digits that Sam wrote down?

 Apr 15, 2023
 #1
avatar
0

(a) The numbers from 1 to 99 include 9 one-digit numbers (1 to 9), 90 two-digit numbers (10 to 99), and a total of 99 numbers. The one-digit numbers have 1 digit each, the two-digit numbers have 2 digits each. Therefore, the total number of digits is:

9 × 1 + 90 × 2 = 9 + 180 = 189

Sam wrote down 189 digits in total.

(b) There are no 0's among the one-digit numbers. Among the two-digit numbers, there are 10 numbers that have 0 as the second digit (10, 20, 30, ..., 90). Therefore, out of the 99 numbers Sam wrote down, 10 have 0 as the second digit. The probability of choosing one of these numbers is:

P(choosing 0) = 10/99

(c) We can calculate the sum of the digits by adding the sum of the digits in each of the numbers. There are 9 one-digit numbers, which add up to 45. The two-digit numbers can be divided into two groups: those whose first digit is 1 (10 to 19) and those whose first digit is 2 to 9 (20 to 99). The sum of the digits in the first group is:

(1 + 0) + (1 + 1) + (1 + 2) + ... + (1 + 9) = 55

To calculate the sum of the digits in the second group, we first notice that there are 8 numbers whose first digit is 2, and each of these numbers contributes 2 to the sum of the digits. Similarly, there are 8 numbers whose first digit is 3, and each of these numbers contributes 3 to the sum of the digits, and so on up to 9 numbers whose first digit is 9, and each of these numbers contributes 9 to the sum of the digits. Therefore, the sum of the digits in the second group is:

8 × 2 + 8 × 3 + ... + 9 × 9 = 2(8 + 9) + 3(8 + 9) + ... + 9(8 + 9) = (8 + 9)(2 + 3 + ... + 9) = 45 × 44/2 = 990

Therefore, the total sum of the digits that Sam wrote down is:

45 + 55 + 990 = 1090

 Apr 15, 2023
 #2
avatar
0

C)

 

n=1;a=99;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 = 900
Total Num = 189

 Apr 15, 2023

6 Online Users

avatar