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 / leninraj

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

Is This Answer Correct ?    57 Yes 32 No



Post New Answer       View All Answers


Please Help Members By Posting Answers For Below Questions

Explain what is the benefit of using enum to declare a constant?

1094


When should volatile modifier be used?

1015


What are run-time errors?

1121


Why C language is a procedural language?

1039


pierrot's divisor program using c or c++ code

2243


How can I find out if there are characters available for reading?

1111


Write a program to implement queue.

1122


What is the purpose of scanf() and printf() functions?

1245


What is self-referential structure in c programming?

1222


what do you mean by enumeration constant?

1014


Write program to remove duplicate in an array?

1084


Are negative numbers true in c?

1069


What is calloc() function?

1103


Explain what does a function declared as pascal do differently?

1294


What are near, far and huge pointers?

1059