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

Can I override protected method in java?

1020


Explain about the security aspect of java?

925


What is a void method java?

910


Explain illegalmonitorstateexception and when it will be thrown?

1040


Why enumeration is faster than iterator?

893


What purpose do the keywords final, finally, and finalize fulfill?

1047


Is a case study a method or methodology?

850


How will you serialize a singleton class without violating singleton pattern?

1902


What is the different types of functions?

994


Can an interface be defined inside a class?

1006


Can we declare the static variables and methods in an abstract class?

941


What does serializing data mean?

899


What does nullpointerexception mean?

1024


What is the purpose of garbage collection in java? When is it used?

999


What are "methods" and "fields"?

973