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 / anil kumar nahak

void main()
{
int n,i,sum=0,r;
printf("enter the value");
scanf("%d",&n);
while(n>0)
{
rem=num%10;
sum=sum+rem;
num=num/10;
}
printf("sum = %d",sum);
}

Is This Answer Correct ?    3 Yes 3 No



Post New Answer       View All Answers


Please Help Members By Posting Answers For Below Questions

Explain 'bus error'?

1109


How can you access memory located at a certain address?

1132


Are the variables argc and argv are local to main?

1325


When can you use a pointer with a function?

1092


write a program to convert a expression in polish notation(postfix) to inline(normal) something like make 723+* (2+3) x 7 (not sure) just check out its mainly printing expression in postfix form to infix.

2849


When should I declare a function?

1150


What is the difference between functions abs() and fabs()?

1166


What is an auto variable in c?

1248


Should I learn c before c++?

1245


Can you please explain the difference between malloc() and calloc() function?

1131


the maximum length of a character constant can be a) 1 character b) 8 characters c) 256 chaacters d) 125 characters

2302


A c program to display count values from 0 to 100 and flash each digit for a secong.reset the counter after it reaches 100.use for loop,. pls guys hepl me.. :(

2261


which is conditional construct a) if statement b) switch statement c) while/for d) goto

1227


What is c programming structure?

1213


What is the difference between union and structure in c?

1196