Answer Posted / asit
public class addDigit {
public static void main(String args[])
{
int num=56782;
int sum=0;
while(num!=0)
{
sum=sum+num%10;
num=num/10;
}
System.out.print(sum);
}
}
| Is This Answer Correct ? | 0 Yes | 0 No |
Post New Answer View All Answers
When arithmeticexception is thrown?
Explain the use of volatile field modifier?
What does arrays sort do in java?
What is boolean false?
What does exp mean in math?
How do you allocate memory to object?
What is the advantage of functional interface in java 8?
Write a program to print count of empty strings in java 8?
What is thread synchronization in java?
What is a substring of a string?
Explain reverse a linked list iterative solution in java?
When is the finalize() called? What is the purpose of finalization?
Explain java heap space and garbage collection?
What is the use of string and stringbuffer?
What is a newline character in java?