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

How do I determine whether a character is numeric, alphabetic, and so on?

1129


Array is an lvalue or not?

1121


Explain about the functions strcat() and strcmp()?

1048


What does d mean?

1085


Can a function be forced to be inline? Also, give a comparison between inline function and the C macro?

1093


What is non linear data structure in c?

1023


Why should I use standard library functions instead of writing my own?

1268


the statement while(i) puts the entire logic in loop. this loop is called a) indefinite loop b) definite loop c) loop syntax wrong d) none of the above

1047


a=10;b= 5;c=3;d=3; if(a printf(%d %d %d %d a,b,c,d) else printf("%d %d %d %d a,b,c,d);

1129


What are the disadvantages of a shell structure?

1345


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

5950


How to draw the flowchart for structure programs?

9336


What is a pointer variable in c language?

1103


Describe dynamic data structure in c programming language?

1093


What are the advantages and disadvantages of a heap?

1209