Advertisement

NUMBER CONVERT INTO DIGITAL

#include<iostream.h>
#include<conio.h>
main()
{
clrscr();
int number,i=0,j,digit;
char * word[1000];
cout<<"--------------INPUT-------------\n\n";
cout<<"ENTER ANY NUMBER == ";
cin>>number;
cout<<"\n\n----------OUTPUT-------------\n\n";
while(number)
{
digit = number %10;
number = number /10;
switch(digit)
{
case 0: word[i++] = "ZERO"; break;
case 1: word[i++] = "ONE"; break;
case 2: word[i++] = "TWO"; break;
case 3: word[i++] = "THREE"; break;
case 4: word[i++] = "FOUR"; break;
case 5: word[i++] = "FIVE"; break;
case 6: word[i++] = "SIX"; break;
case 7: word[i++] = "SEVEN"; break;
case 8: word[i++] = "EIGHT"; break;
case 9: word[i++] = "NINE"; break;
}
}
for(j=i-1;j>=0;j--)
{
cout<<" "<<word[j];
}
getch();
}

Post a Comment

1 Comments

  1. MN Park is a collaborative innovation ecosystem dedicated to the development of world-class R&D laboratory spaces and innovation infrastructure for life sciences companies and caters to their research, warehousing, and clean manufacturing needs.Visit:- https://www.mn-park.com/

    ReplyDelete

USE ANONYMOUS PROFILE IF YOU WANT D'NT SHARE EMAIL