01/03/2023

C Program to Print Day of Week Name Using Switch Case

C program to print the day of week name using switch case or C Program to Print Day of Week Name Using Switch Case or C Program to Print Days of Week in Words using Switch Case Statement or Program in C to Display day of the week using switch case or C program to input a number of week's day(1-7) and translate to its equivalent name of the day of the week or Simple C Program for Switch case to Find weekdays name or print Days of Week using switch-case or program to print days of the week using a switch.

In this problem, we have to find the day, let's take input as an example suppose the user enters 5(User input should be between 1 to 7 ) then our program will print the message on the screen " Today Is Friday ", and for other input, it will print the appropriate message on the screen. If the user thinks he is smart and he is trying to enter some other than values 1 to 7 then the program will print the message " Don't be Smart Wrong Choice Try Again!!!". the program will work only if values are 1 to 7.

C Program to Print Day of Week Name Using Switch Case


#include <stdio.h>

main()
{
	/*c program to print days of week using switch */
	int choice;

	printf("Monday Will be First Days and So On\n\n");
	printf("Enter Any Number Between (1 to 7):");

	scanf("%d", &choice);
	printf("\n");

	switch (choice)
	{
		case 1:
			printf("Today is Monday");
			break;
		case 2:
			printf("Today is Tuesday");
			break;
		case 3:
			printf("Today is Wednesday");
			break;
		case 4:
			printf("Today is Thursday");
			break;
		case 5:
			printf("Today is Friday");
			break;
		case 6:
			printf("Today is Saturday");
			break;
		case 7:
			printf("Today is Sunday");
			break;
		default:
			printf("Don't Be Smart....Wrong Choice Try Again!!!");
	}

	getch();
}

The output of C Program to Print Day of Week Name


The output of C Program to Print Day of Week Name

Similar Day of Week Name Using Switch Case


Previous Post
Next Post

post written by:

Hi, I’m Ghanendra Yadav, SEO Expert, Professional Blogger, Programmer, and UI Developer. Get a Solution of More Than 500+ Programming Problems, and Practice All Programs in C, C++, and Java Languages. Get a Competitive Website Solution also Ie. Hackerrank Solutions and Geeksforgeeks Solutions. If You Are Interested to Learn a C Programming Language and You Don't Have Experience in Any Programming, You Should Start with a C Programming Language, Read: List of Format Specifiers in C.
Follow Me

0 Comments: