//Write a program to print Sunday, Monday…………….Saturday using if.
#include<iostream.h>
#include<conio.h>
void main()
{
clrscr();
int c;
cout<<”Enter your choice: “;
cin>>c;
cout<<endl;
if(c==1)
cout<<”Today is Monday”;
else if(c==2)
cout<<”Today is Tuesday”;
else if(c==3)
cout<<”Today is Wednesday”;
else if (c==4)
cout<<”Today is Thursday”;
else if(c==5)
cout<<”Today is Friday”;
else if(c==6)
cout<<”Today is Saturday”;
else if (c==7)
cout<<”Today is Sunday”;
else
cout<<”Invalid Input”;
getch();
}
Output:
#include<iostream.h>
#include<conio.h>
void main()
{
clrscr();
int c;
cout<<”Enter your choice: “;
cin>>c;
cout<<endl;
if(c==1)
cout<<”Today is Monday”;
else if(c==2)
cout<<”Today is Tuesday”;
else if(c==3)
cout<<”Today is Wednesday”;
else if (c==4)
cout<<”Today is Thursday”;
else if(c==5)
cout<<”Today is Friday”;
else if(c==6)
cout<<”Today is Saturday”;
else if (c==7)
cout<<”Today is Sunday”;
else
cout<<”Invalid Input”;
getch();
}
Output:
No comments:
Post a Comment