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 / pankaj khaitan

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

Is This Answer Correct ?    40 Yes 15 No



Post New Answer       View All Answers


Please Help Members By Posting Answers For Below Questions

What is function pointer c?

1064


write a c program to calculate sum of digits till it reduces to a single digit using recursion

3271


What are the advantages and disadvantages of c language?

982


Explain what are multidimensional arrays?

1021


What are the applications of c language?

1037


What is floating point constants?

1098


Difference between constant pointer and pointer to a constant.

1090


What are loops in c?

971


If null and 0 are equivalent as null pointer constants, which should I use?

1156


a way in which a pointer stores the address of a pointer which stores the value of the target value a) reference b) allocation c) multiple indirection d) none

1114


What is nested structure with example?

1040


What are multibyte characters?

1075


Explain modulus operator. What are the restrictions of a modulus operator?

985


What are operators in c?

994


Device an algorithm for weiler-atherton polygon clipping, where the clipping window can be any specified polygon

5917