Question: Write a Python program that gets an integer input from the user and calculates the sum of the digits in it . Steps: - Create
Write a Python program that gets an integer input from the user and calculates the sum of the digits in
it
Steps:
Create a file with the name findSum.py
Get the number from the user using the input function.
Initialize a variable sum to
Write the logic to find the sum of the digits of the number Use while loopHint: Extract last digit
of the number, add it to the sum and remove that digit from the number
Print the sum.
Sample Input:
Enter a number:
Output:
Sum of the digits:
Step by Step Solution
There are 3 Steps involved in it
1 Expert Approved Answer
Step: 1 Unlock
Question Has Been Solved by an Expert!
Get step-by-step solutions from verified subject matter experts
Step: 2 Unlock
Step: 3 Unlock
