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

Write a program in c to input a 5 digit number and print it
in words.

Answer Posted / rakesh.bit

# include <stdio.h>
int main ()
{
int n,temp,t,s=0,i,ctr=0;
char a[10][10] = {"zero", "one", "two", "three", "four",
"five", "six", "seven", "eight", "nine"};
printf ("Enter the number:\n");
scanf ("%d", &n);
//printf ("The given num in word = %s\n", a[n]);
t=n;
while(n>0)
{
ctr++;
n=n/10;
}
while(t>0)
{
temp=t%10;
s=10*s+temp;
t=t/10;
}

for(i=0;i<ctr;i++)
{
printf("%s",a[s%10]);
s=s/10;
}
}

Is This Answer Correct ?    22 Yes 16 No



Post New Answer       View All Answers


Please Help Members By Posting Answers For Below Questions

What is operator precedence?

1152


Why is c called c not d or e?

1052


How can my program discover the complete pathname to the executable from which it was invoked?

1037


Tell me when would you use a pointer to a function?

1015


What is data structure in c programming?

1032


Explain how can you tell whether two strings are the same?

973


How a string is stored in c?

1019


What are structure members?

1028


Can a variable be both const and volatile?

1074


what is recursion in C

1023


How do I send escape sequences to control a terminal or other device?

1016


What are structures and unions? State differencves between them.

1103


Explain how can I convert a string to a number?

1029


What is pass by reference in functions?

776


WRITE A PROGRAM TO MERGE TWO SORTED ARRAY USING MERGE SORT TECHNIQUE..

1990