Question: Using C#: Write code that takes a non-negative long instead of an int so we can use bigger numbers , as input and display each

Using C#: Write code that takes a non-negative long instead of an int so we can use bigger numbers, as input and display each of the digits on a separate line. Note you do not know how many digits the integer has. You may not use string methods for the following few assignments, you must use mod%. Finally, use your method getDigitSum() to display the sum of the digits of a number entered by the user.

********************************************** This program will take your number and display each of the digits on a separate line. ********************************************** Enter a number: 3572213 3 5 7 2 2 

1

3

********************************************** This program will display the sum of the digits of any positive integer you enter. ********************************************** Enter an integer: 145  The sum of the digits of 145 is 10. Would you like to try another? Y Enter an integer: 8888  The sum of the digits of 8888 is 32. Would you like to try another? N  Thank you for using this program. Have a nice day.
 

Step by Step Solution

There are 3 Steps involved in it

1 Expert Approved Answer
Step: 1 Unlock blur-text-image
Question Has Been Solved by an Expert!

Get step-by-step solutions from verified subject matter experts

Step: 2 Unlock
Step: 3 Unlock

Students Have Also Explored These Related Databases Questions!