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

What is the collection of communication lines and routers called?

1082


Explain the difference between call by value and call by reference in c language?

1074


Explain the use of keyword 'register' with respect to variables.

988


What are multibyte characters?

1074


What happens if a header file is included twice?

1001


Is there a way to switch on strings?

1050


What are different types of pointers?

1030


How do you define a function?

997


Stimulate calculator using Switch-case-default statement for two numbers

2936


What is array within structure?

1080


Why is c called a mid-level programming language?

1168


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

2571


Explain what is meant by 'bit masking'?

1149


What is the scope of static variable in c?

970


What are control structures? What are the different types?

1058