Write a program in Java to input any number through a function argument and print the sum of
its digits.
Answers
Answered by
4
Answer:
public class Digit_Sum.
int m, n, sum = 0;
Scanner s = new Scanner(System.
System. out. print("Enter the number:");
m = s. nextInt();
while(m > 0)
n = m % 10;
sum = sum + n;
Explanation:
hope it will help you
Similar questions