Program to use switch statement. Display Monday to Sunday.
C Programming Language / Decision Making of C Language
15678Program:
/* Program to use switch statement. Display Monday to Sunday. Author: Atnyla Developer */ #include #include void main() { char ch; printf("enter m for Monday \nt for Tuesday\nw for Wednesday\nh for Thursday\nf for Friday\ns for Saturday\nu for Sunday \n"); printf("..............."); scanf("%c",&ch); switch(ch) { case 'm': case 'M': printf("monday \n"); break; case 't': case 'T': printf("tuesday \n"); break; case 'w': case 'W': printf("wednesday \n"); break; case 'h': case 'H': printf("thursday \n"); break; case 'f ': case 'F': printf("friday \n"); break; case 's': case 'S': printf("saturday \n"); break; case 'u': case 'U': printf("sunday \n"); break; default: printf("wrong input \n"); break; } getch(); }
Output:
enter m for Monday t for Tuesday w for Wednesday h for Thursday f for Friday s for Saturday u for Sunday ...............m monday Press any key to continue . . .
Explanation:
Program to use switch statement. Display Monday to Sunday.
This Particular section is dedicated to Programs only. If you want learn more about C Programming Language. Then you can visit below links to get more depth on this subject.
# C Tutorials
# JAVA Tutorials
# HTML Tutorials
# Computer Fundamental
# Data Structure
# DBMS Tutorials
SQL
# C# Language
# R Language
# PHP
# Python
# Vue JS