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

Where is jre installed?

1097


How we create object in copy constructor?

1174


Is static a keyword in java?

1029


Why is string class considered immutable?

1113


Which is better singleton or static class?

1033


What do you mean by hashing?

1170


How to create an immutable class?

1180


What is advantage of java?

1073


What is the difference between applet and application?

1089


Write a java program that prints all the values given at command-line.

1059


How will you initialize an Applet?

1205


What is a final class in java?

1072


What's the purpose of using break in each case of switch statement?

1047


What is the disadvantage of synchronization?

1063


What is a static class in java?

1059