Computer Science, asked by heetshahh, 3 months ago

write a program to enter any number and find sum of digits using static function that returns a value

Answers

Answered by XxitsmrseenuxX
5

Answer:

Static method sum(long num), will calculate the sum of digits of a number. 2) Read entered value. Call the static method sum(n) in the main method then the static method will be executed. This method adds the remainder to sum and n=n/10, these 2 steps will repeat until num!=

Answered by sainitushar6742
0

Answer:

Static method sum(long num), will calculate the sum of digits of a number. 2) Read entered value. Call the static method sum(n) in the main method then the static method will be executed. This method adds the remainder to sum and n=n/10, these 2 steps will repeat until num!=

Explanation:

follw

Similar questions