Input a number and write a program to spell all the digit of that number.
#include <stdio.h>
#include <conio.h>
void main ( )
{
char dg[ ][7] = { "Zero", "One", "Two", "Three", "Four", "Five",
"Six", "Seven", "Eight", "Nine" };
int no, c = 0, md[10], d = 0;
clrscr ( );
printf("\n\n\n\t\t Enter a Number (less than 32767)...:"); scanf("%d", &no);
while ( no > 0 )
{
md[c] = no % 10;
no = no /10;
c++;
}
printf("\n\n\n\t Digits are [ in word].....:");
for ( d = c - 1; d >= 0; d-- )
{
printf("%s ", dg[ md[d] ] );
}
getch ( );
}
Click here to contact us
#include <stdio.h>
#include <conio.h>
void main ( )
{
char dg[ ][7] = { "Zero", "One", "Two", "Three", "Four", "Five",
"Six", "Seven", "Eight", "Nine" };
int no, c = 0, md[10], d = 0;
clrscr ( );
printf("\n\n\n\t\t Enter a Number (less than 32767)...:"); scanf("%d", &no);
while ( no > 0 )
{
md[c] = no % 10;
no = no /10;
c++;
}
printf("\n\n\n\t Digits are [ in word].....:");
for ( d = c - 1; d >= 0; d-- )
{
printf("%s ", dg[ md[d] ] );
}
getch ( );
}
Click here to contact us
No comments:
Post a Comment