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 / rakesh ranjan

#include<conio.h>
#include<stdio.h>
main()
{
int x=0,n,i;
printf("entre the number");
scanf("%d",&n);
for(;n>0;n/=10)
x=x+n%10;
printf("sum = %d",x);
getch();
}

Is This Answer Correct ?    0 Yes 2 No



Post New Answer       View All Answers


Please Help Members By Posting Answers For Below Questions

The postoder traversal is 7,14,3,55,22,5,17 Then ur Inorder traversal is??? please help me on this

3665


What's the total generic pointer type?

1109


What is #include stdlib h?

1148


What are pointers? What are different types of pointers?

1226


How can a process change an environment variable in its caller?

1239


Explain what is the difference between the expression '++a' and 'a++'?

1267


What header files do I need in order to define the standard library functions I use?

1127


What are valid operations on pointers?

1264


main() { printf("hello"); fork(); }

1251


What are conditional operators in C?

1147


Is there a built-in function in C that can be used for sorting data?

1343


Why is c called c?

1077


How can I write a function analogous to scanf?

1236


What is use of #include in c?

1223


What does the c preprocessor do?

1160