Find the sum of squares of individual digits of a number 'sqdnumber' and store the sum in variable 'sqdNumber_result'. E.g. if the number is 234, the sum is computed as (22 + 32 + 42 = 4 + 9 + 16 = 29)
Answers
Answered by
0
Answer:
Explanation:
The difficult part here is to extract the digits.
You can do this in a single loop.
Extract the digit in the units place by doing a mod 10 -> digit = number % 10.
To continue the loop reduce the number by dividing it by 10 -> number /= 10.
I'm sure you can figure out the rest by yourself.
But if you have trouble doing that, try outputting the values of each variable inside the loop.
Similar questions