How to to accept any single digit number and print it in words in C++ Program

CWC
1 Min Read

A c++ Program to accept any single digit number and print it in words.

# include  
# include  
# include  
using namespace std; 
int main( ) 
{ 
int n; 
cout<<"enter a number :"; cin>>n; switch(n) 
{ 
case 0: cout<<"ZERO"; 
break; 
case 1: cout<<"ONE"; 
break; 
case 2: cout<<"TWO"; 
break; 
case 3: cout<<"THREE"; 
break; 
case 4: cout<<"FOUR"; 
break; 
case 5: cout<<"FIVE"; 
break; 
case 6: cout<<"SIX"; 
break; 
case 7: cout<<"SEVEN"; 
break;
case 8: cout<<"EIGHT"; 
break; 
case 9cout<<"NINE"; break; 
default: cout<<"please enter the number between 0  and 9"; 
} 
return 0; 
}
Share This Article
Leave a comment

Leave a Reply

Your email address will not be published. Required fields are marked *

English
Exit mobile version