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
Can I override protected method in java?
Explain about the security aspect of java?
What is a void method java?
Explain illegalmonitorstateexception and when it will be thrown?
Why enumeration is faster than iterator?
What purpose do the keywords final, finally, and finalize fulfill?
Is a case study a method or methodology?
How will you serialize a singleton class without violating singleton pattern?
What is the different types of functions?
Can an interface be defined inside a class?
Can we declare the static variables and methods in an abstract class?
What does serializing data mean?
What does nullpointerexception mean?
What is the purpose of garbage collection in java? When is it used?
What are "methods" and "fields"?