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...

Program to find the sum of digits of a given number until
the sum becomes a single digit

Answer Posted / suvabrata das

#include<stdio.h>
#include<conio.h>
void main()
{
int n,c=0,r,i;
clrscr();
printf("enter no.");
scanf("%d",&n);
while(n>0)
{
{
r=n%10;
c=c+r;
n=n/10;
}
if(c>9)
{
n=c;
c=0;
}
}
printf("%d",c);
getch();
}

Is This Answer Correct ?    58 Yes 34 No



Post New Answer       View All Answers


Please Help Members By Posting Answers For Below Questions

Does c have function or method?

991


What is the difference between a string copy (strcpy) and a memory copy (memcpy)? When should each be used?

1111


What is far pointer in c?

1305


In a switch statement, what will happen if a break statement is omitted?

1058


Difference between pass by reference and pass by value?

1151


I need a sort of an approximate strcmp routine?

1024


Is c high or low level?

1003


What is the difference between specifying a constant variable like with constant keyword and #define it? i.e what is the difference between CONSTANT FLOAT A=1.25 and #define A 1.25

1973


Where static variables are stored in c?

1105


What is call by reference in functions?

1429


What is the benefit of using an enum rather than a #define constant?

1230


Explain how can I avoid the abort, retry, fail messages?

1042


can anyone suggest some site name..where i can get some good data structure puzzles???

2082


What is chain pointer in c?

1058


Can static variables be declared in a header file?

1058