Golgappa.net | Golgappa.org | BagIndia.net | BodyIndia.Com | CabIndia.net | CarsBikes.net | CarsBikes.org | CashIndia.net | ConsumerIndia.net | CookingIndia.net | DataIndia.net | DealIndia.net | EmailIndia.net | FirstTablet.com | FirstTourist.com | ForsaleIndia.net | IndiaBody.Com | IndiaCab.net | IndiaCash.net | IndiaModel.net | KidForum.net | OfficeIndia.net | PaysIndia.com | RestaurantIndia.net | RestaurantsIndia.net | SaleForum.net | SellForum.net | SoldIndia.com | StarIndia.net | TomatoCab.com | TomatoCabs.com | TownIndia.com
Interested to Buy Any Domain ? << Click Here >> for more details...

if num=687;
U have to get
num=6+8+7;

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


Please Help Members By Posting Answers For Below Questions

When arithmeticexception is thrown?

1079


Explain the use of volatile field modifier?

1138


What does arrays sort do in java?

1084


What is boolean false?

1028


What does exp mean in math?

1054


How do you allocate memory to object?

1048


What is the advantage of functional interface in java 8?

1049


Write a program to print count of empty strings in java 8?

1065


What is thread synchronization in java?

953


What is a substring of a string?

1236


Explain reverse a linked list iterative solution in java?

964


When is the finalize() called? What is the purpose of finalization?

1143


Explain java heap space and garbage collection?

1134


What is the use of string and stringbuffer?

1052


What is a newline character in java?

1090