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

C++ is a high level programming language. This program is using to print day of a week using if else statement using C++ Language. In C++ language cout function is used to print output in a screen.

Program:

#include <iostream>
using namespace std;

int main()
{
    int day;   
    cout<<"Enter Day Number (1 to 7): "; 
    cin>>day;
    if (day == 1) 
	{ 
    cout<<"Monday";
    } 
    else if(day == 2) 
    {
    cout<<"Tuesday";
    }
    else if(day == 3) 
    {
    cout<<"Wednesday";
    }
    else if(day == 4) 
    {
    cout<<"Thursday";
    }
    else if(day == 5) 
    {
    cout<<"Friday";
    }
    else if(day == 6) 
    {
    cout<<"Saturday";
    }
    else
    {
    cout<<"Sunday";
    }
    
}
 

Khubab Hamza

Read Previous

C++ Program to check whether given character is alphabet or not

Read Next

C++ program to print day of a week using switch statement

Leave a Reply

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

Most Popular