SOURCE CODE OUTPUT
#include<iostream>
using namespace std;
int main()
{
int num,x=0,y;
cout<<"Enter the number ";
cin>>num;
while(num!=0)
{
x=x*10+num%10;
num/=10;
}
while(x>0)
{
y=x%10;
x/=10;
switch(y+1)
{
case 1:
cout<<"zero";
break;
case 2:
cout<<"one";
break;
case 3:
cout<<"two";
break;
case 4:
cout<<"three";
break;
case 5:
cout<<"four";
break;
case 6:
cout<<"five";
break;
case 7:
cout<<"six";
break;
case 8:
cout<<"seven";
break;
case 9:
cout<<"eight";
break;
case 10:
cout<<"nine";
break;
}
cout<<" ";
}
return 0;
}
using namespace std;
int main()
{
int num,x=0,y;
cout<<"Enter the number ";
cin>>num;
while(num!=0)
{
x=x*10+num%10;
num/=10;
}
while(x>0)
{
y=x%10;
x/=10;
switch(y+1)
{
case 1:
cout<<"zero";
break;
case 2:
cout<<"one";
break;
case 3:
cout<<"two";
break;
case 4:
cout<<"three";
break;
case 5:
cout<<"four";
break;
case 6:
cout<<"five";
break;
case 7:
cout<<"six";
break;
case 8:
cout<<"seven";
break;
case 9:
cout<<"eight";
break;
case 10:
cout<<"nine";
break;
}
cout<<" ";
}
return 0;
}
Any questions regarding to program please write in comments.
No comments:
Post a Comment