Question: Please write code in C and please add comments Questions Write a loop based C program that takes a positive number as input from the
Please write code in C and please add comments
Questions
Write a loop based C program that takes a positive number as input from the user via the
keyboard and calculates the sum of all the individual digits in that number. Display the
result. Note that if the user enters a negative number, your program must keep asking the
user until a valid number is entered. Below are some sample outputs for how the program
should behave. Note that the input number is not necessarily digit.
Sample Run :
Enter a positive nubmber:
Sum of all digits in is
Sample Run :
Enter a positive nubmber:
Sum of all digits in is
Sample Run :
Enter a positive nubmber:
You entered an invalid number
Reenter the number:
You entered an invalid number
Reenter the number:
Sum of all digits in is
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
