C++ Practical Programs

- Write a C++ program to accept a number. Using conditional operator print whether the number is even or odd.
PROGRAM

Output

- Write a C++ program to accept a character. Print whether the character is an alphabet, digit, or a special character. Display appropriate messages.
PROGRAM

Output

Write a C++ program to accept a number and display the corresponding number of week day
PROGRAM
*******************************************************************************/
#include <iostream>
using namespace std;
int main() {
int day;
cout<<"Enter a number(1-7) to display the corresponding weekday: ";
cin>>day;
switch(day) {
case 1:
cout<<"The day is monday."<<endl;
break;
case 2:
cout<<"The day is tuesday."<<endl;
break;
case 3:
cout<<"The day is wednesday."<<endl;
break;
case 4:
cout<<"The day is thursday."<<endl;
break;
case 5:
cout<<"The day is friday."<<endl;
break;
case 6:
cout<<"The day is saturday."<<endl;
break;
case 7:
cout<<"The day is sunday."<<endl;
break;
default:
cout<<"invalid number ! please enter a number between 1&7"<<endl;
break;
}
return 0;
}
Output


