Group 2
View the problem here.
Here we have to add the sum of digits of a number. We can go about doing it by taking taking 1 digit at a time and adding it to the result.
Note: that whenever you write programs like these, always test for boundary conditions. Eg. Will the program work when the input is 0? What if the number is a negative number? etc.
Please click on the image for clarity.
Request: Please take the quiz or leave your comment to help me make this site more useful. Thanks
Subscribe to:
Post Comments (Atom)
No comments:
Post a Comment