wap to find a sum of digit of a number given by user in java
Answers
Answered by
0
Answer:
Java Program to Compute the Sum of Digits in a given Integer
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;
Similar questions
Physics,
3 months ago
Math,
3 months ago
Political Science,
7 months ago
Political Science,
1 year ago