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

How can I change their mode to binary?

1050


Why c is called a mid level programming language?

1019


Explain how do you view the path?

1085


How can you return multiple values from a function?

1050


What is the difference between malloc() and calloc() function in c language?

1028


What does malloc () calloc () realloc () free () do?

1000


What is header file definition?

1023


the real constant in c can be expressed in which of the following forms a) fractional form only b) exponential form only c) ascii form only d) both a and b

2610


What is pass by reference in c?

1142


Explain what is the difference between a string and an array?

1099


What does %d do?

1203


Explain how can you check to see whether a symbol is defined?

1083


What is int main () in c?

1024


Write the control statements in C language

1125


What is struct node in c?

1014