What should be the “condition” so that the following code snippet prints both HelloWorld !
Here is an implementation.
Algorithm: roundNo(num) 1. If num is positive then add 0.5. 2. Else subtract 0.5. 3. Type cast the result to int and return.
Use printf statement inside the if condition
We strongly recommend that you click here and practice it, before moving on to the solution. Below are the solutions to get sum of the digits.
If we take a look at this problem carefully, we can see that the idea of “loop” is to track some counter value e.g. “i=0” till “i