statements to print the sum of digits of a number. What condition
should be used in place of "X" to get the desired output?
integer num=3678, j=0
do
{
j=j+(num%10)
}while(X)
print j
Answers
Answered by
7
Answer:
(num/10)Not equal to 0
Explanation:
That is the wright answer
Answered by
0
X will be replaced by num/10
Explanation:
- Here the given program calculates the sum of digits of a given number as input.
- Here, in this case, the given input is 3678.
- Here the sum is stored in variable j.
- This program iteratively fetches the unit digit of the number and adds it in the j variable.
- This loop should terminate until the number becomes zero.
Thus the condition in place of X will be num/10
Similar questions
Computer Science,
3 days ago
Geography,
3 days ago
Math,
7 days ago
English,
7 days ago
Science,
7 months ago