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

Why malloc is faster than calloc?

1060


What are the complete rules for header file searching?

1073


"%u" unsigned integer print the a) address of variable b) value of variable c) name of a variable d) none of the above

1011


What's the right way to use errno?

1135


Write a program to print fibonacci series without using recursion?

1128


Program to find the sum of digits of a given number until the sum becomes a single digit. (e.g. 12345=>1+2+3+4+5=15=>1+5=6)

1146


what is associativity explain what is the precidence for * and & , * and ++ how the folloing declaration work 1) *&p; 2) *p++;

2636


What is the equivalent code of the following statement in WHILE LOOP format?

1295


Write a C/C++ program to add a user to MySQL. The user should be permitted to only "INSERT" into the given database.

1965


Why do we use pointer to pointer in c?

1082


What is the meaning of && in c?

1012


What is function prototype in c with example?

1070


What is a constant?

1055


What is ambagious result in C? explain with an example.

2626


How is null defined in c?

1150