Question: in python Exercise # 3: Write a python program that reads an integer from the user and prints back the number of the digits in
in python
Exercise # 3: Write a python program that reads an integer from the user and prints back the number of the digits in that integer and the sum of them. For example, if the input was 2308, the output would be: Your integer has 4 digits and their sum is 13. Hints: N%10 will always generate the rightmost digit of the integer N. N/10 will always generate the same integer WITHOUT its rightmost digit. When you have on digit (any of 0 to 9) and you divide it by 10 (integer division), the result is always 0. You can use this idea to stop the loop. The following are sample runs of the program: Sample run 1:* Enter a positive integer value: 2308 Your integer has 4 digits and their sum is 13 Sample run 2:* Enter a positive integer value: 714702 Your integer has 6 digits and their sum is 21
Step by Step Solution
There are 3 Steps involved in it
Get step-by-step solutions from verified subject matter experts
