21. Write a Program to input day in digit and print in words.
Answer:
#include<iostream.h>
#include<conio.h>
Void main()
{
int d;
cout<<"Enter day in digit";
cin>>d;
if(d==1)
{
cout<<"Monday";
}
else if(d==2)
{
cout<<"Tuesday";
}
else if(d==3)
{
cout<<"Wednesday";
}
else if(d==4)
{
cout<<"Thrusday";
}
else if(d==5)
{
cout<<"Friday";
}
else if(d==6)
{
cout<<"Saturday";
}
else if(d==7)
{
cout<<"Sunday";
}
else
{
cout<<"Invalid Choice....";
}
getch();
}
...................................................................................................................................................................
22. Write a Program to input a digit and print them in words.
Answer:
#include<iostream.h>
#include<conio.h>
Void main()
{
cout<<"Enter the Digit:";
cin>>d;
if(d==1)
{
cout<<"One";
}
else if(d==2)
{
cout<<"Two";
}
else if(d==3)
{
cout<<"Three";
}
else if(d==4)
{
cout<<"Four";
}
else if(d==5)
{
cout<<"Five";
}
else
{
cout<<"Out Of Range....";
}
getch();
}
...................................................................................................................................................................
23. Write a Program to input day in digit and print in words (by Swith Case).
Answer:
#include<iostream.h>
#include<conio.h>
Void main()
{
int d;
cout<<"Enter day in Digit";
cin>>d;
switch(d)
{
case 1:
cout<<"\n Monday"
break;
case 2:
cout<<"\n Tuesday";
break;
case 3:
cout<<"\n Wednesday";
break;
case 4:
cout<<\n Thursday";
break;
case 5:
cout<<\n Friday";
break;
case 6:
cout<<\n Saturday";
break;
case 7:
cout<<\n Sunday";
break;
default:
cout<<\n Out of Range!";
}
getch();
}
...................................................................................................................................................................
24. Write a Program to input a month in digit and print in words (by swith case).
Answer :
#include<iostream.h>
#include<conio.h>
Void main()
{
int d;
cout<<"Enter the Digit";
cin>>d;
switch(d)
{
case 1:
cout<<"\n January";
break;
case 2:
cout<<"\n February";
break;
case 3:
cout<<"\n March";
break;
case 4:
cout<<"\n April";
break;
case 5:
cout<<"\n May";
break;
case 6:
cout<<"\n June";
break;
case 7:
cout<<"\n July";
break;
case 8:
cout<<"\n August";
break;
case 9:
cout<<"\n September";
break;
case 10:
cout<<"\n October";
break;
case 11:
cout<<"\n November";
break;
case 12:
cout<<"\n December";
break;
default:
cout<<"Out of Range!"
}
getch();
}
Answer:
#include<iostream.h>
#include<conio.h>
Void main()
{
int d;
cout<<"Enter day in digit";
cin>>d;
if(d==1)
{
cout<<"Monday";
}
else if(d==2)
{
cout<<"Tuesday";
}
else if(d==3)
{
cout<<"Wednesday";
}
else if(d==4)
{
cout<<"Thrusday";
}
else if(d==5)
{
cout<<"Friday";
}
else if(d==6)
{
cout<<"Saturday";
}
else if(d==7)
{
cout<<"Sunday";
}
else
{
cout<<"Invalid Choice....";
}
getch();
}
...................................................................................................................................................................
22. Write a Program to input a digit and print them in words.
Answer:
#include<iostream.h>
#include<conio.h>
Void main()
{
cout<<"Enter the Digit:";
cin>>d;
if(d==1)
{
cout<<"One";
}
else if(d==2)
{
cout<<"Two";
}
else if(d==3)
{
cout<<"Three";
}
else if(d==4)
{
cout<<"Four";
}
else if(d==5)
{
cout<<"Five";
}
else
{
cout<<"Out Of Range....";
}
getch();
}
...................................................................................................................................................................
23. Write a Program to input day in digit and print in words (by Swith Case).
Answer:
#include<iostream.h>
#include<conio.h>
Void main()
{
int d;
cout<<"Enter day in Digit";
cin>>d;
switch(d)
{
case 1:
cout<<"\n Monday"
break;
case 2:
cout<<"\n Tuesday";
break;
case 3:
cout<<"\n Wednesday";
break;
case 4:
cout<<\n Thursday";
break;
case 5:
cout<<\n Friday";
break;
case 6:
cout<<\n Saturday";
break;
case 7:
cout<<\n Sunday";
break;
default:
cout<<\n Out of Range!";
}
getch();
}
...................................................................................................................................................................
24. Write a Program to input a month in digit and print in words (by swith case).
Answer :
#include<iostream.h>
#include<conio.h>
Void main()
{
int d;
cout<<"Enter the Digit";
cin>>d;
switch(d)
{
case 1:
cout<<"\n January";
break;
case 2:
cout<<"\n February";
break;
case 3:
cout<<"\n March";
break;
case 4:
cout<<"\n April";
break;
case 5:
cout<<"\n May";
break;
case 6:
cout<<"\n June";
break;
case 7:
cout<<"\n July";
break;
case 8:
cout<<"\n August";
break;
case 9:
cout<<"\n September";
break;
case 10:
cout<<"\n October";
break;
case 11:
cout<<"\n November";
break;
case 12:
cout<<"\n December";
break;
default:
cout<<"Out of Range!"
}
getch();
}
*********************************************************************************
0 comments:
Post a Comment