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...

how to find sum of digits in C?

Answer Posted / bhagwat

main()
{
int n,i,sum=0,r;
printf("enter the value");
scanf("%d",&n);
while(n!=0)
{
r=n%10;
n=n/10;
sum=sum+r;
}

Is This Answer Correct ?    53 Yes 19 No



Post New Answer       View All Answers


Please Help Members By Posting Answers For Below Questions

Differentiate between null and void pointers.

1135


all c language question

2404


A collection of functions,calls,subroutines or other data a) library b) header files c) set of files d) textfiles

1143


Describe the modifier in c?

1072


When I tried to go into a security sites I am denied access and a message appeared saying 'applet not initialize'. How can I rectify this problem.

1951


What is the use of bit field?

1148


What is a MAC Address?

1023


disply the following menu 1.Disply 2.Copy 3.Append; as per the menu do the file operations 4.Exit

2035


What is wrong with this program statement? void = 10;

1223


Write a program that accept anumber in words

1724


what is the different bitween abap and abap-hr?

2253


Can you please explain the difference between malloc() and calloc() function?

1072


What is #include stdio h and #include conio h?

1066


Explain how do you generate random numbers in c?

1059


Explain the use of 'auto' keyword

1096