C++, Programmimg Languages

Write a program in C++ to print day of week using else if

​#include<iostream.h>

#include<conio.h>

main()

{

int a;

cout<<“Enter any value”;

cin>>a;

if(a==1)

cout<<“Day is Sunday”;

else

if(a==2)

cout<<“Day is Monday”;

else

if(a==3)

cout<<“Day is Tuesday”;

else

if(a==4)

cout<<“Day is Wednesday”;

else

if(a==5)

cout<<“Day is Thursday”;

else

if(a==6)

cout<<“Day is Friday”;

else

if(a==7)

cout<<“Day is Saturday”;

else

cout<<“Invalid Option”;

getch();
}

Advertisements

Leave a Reply

Fill in your details below or click an icon to log in:

WordPress.com Logo

You are commenting using your WordPress.com account. Log Out / Change )

Twitter picture

You are commenting using your Twitter account. Log Out / Change )

Facebook photo

You are commenting using your Facebook account. Log Out / Change )

Google+ photo

You are commenting using your Google+ account. Log Out / Change )

Connecting to %s