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

In a byte, what is the maximum decimal number that you can accommodate?

1156


Explain what are linked list?

1053


What are the different types of data structures in c?

1179


Device an algorithm for weiler-atherton polygon clipping, where the clipping window can be any specified polygon

5966


What is the -> in c?

1027


What are the disadvantages of external storage class?

1071


write a c programming using command line argument,demonstrate set operation(eg;union,intersection,difference) example output is c:>setop 12 34 45 1 union 34 42 66 c:>setop 12 34 1 42 66 c:>setop 12 34 diff 12 56 67 78 setop 12 34

2200


What is a loop?

1076


What are data types in c language?

1068


Can 'this' pointer by used in the constructor?

1107


Why is not a pointer null after calling free?

1035


Explain about the constants which help in debugging?

1387


What is equivalent to ++i+++j?

1107


What is the advantage of a random access file?

1218


What is wrong with this declaration?

1121