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 / anil kumar nahak

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

Is This Answer Correct ?    3 Yes 3 No



Post New Answer       View All Answers


Please Help Members By Posting Answers For Below Questions

Explain that why C is procedural?

1087


List out few of the applications that make use of Multilinked Structures?

2115


Give the rules for variable declaration?

1118


Explain why can’t constant values be used to define an array’s initial size?

1307


Why is c fast?

1012


What is an operator?

1021


When should you not use a type cast?

1072


#include main() { enum _tag{ left=10, right, front=100, back}; printf("left is %d, right is %d, front is %d, back is %d",left,right,front,back); }

1070


Why is c so popular?

1120


How pointers are declared?

911


What is header file definition?

1029


Explain what are the advantages and disadvantages of a heap?

1036


What is the best style for code layout in c?

1052


Which header file should you include if you are to develop a function which can accept variable number of arguments?

1324


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

1122