Wednesday, January 19, 2022

Days of the Week Using Switch Statement in C

 A simple program that will ask the user to give a number from 1 to 7 which represents days of the week like 1 - Monday, 2 - Tuesday, 3 - Wednesday, 4 - Thursday, 5-Friday, 6-Saturday, 7- Sunday using switch statement in C programming language.

I am currently accepting programming work, IT projects, school and application development, programming projects, thesis and capstone projects, IT consulting work, computer tutorials, and web development work kindly contact me in the following email address for further details.  If you want to advertise on my website kindly contact me also in my email address also. Thank you.


My email address is the following jakerpomperada@gmail.com, jakerpomperada@aol.com, and jakerpomperada@yahoo.com.

My mobile number here in the Philippines is 09173084360.





Program Listing

days.c


#include<stdio.h>

#include<conio.h>


void main()

{

int day=0;

printf("\n\n");

printf("\tDays of the Week Using Switch Statement in C");

printf("\n\n");

printf("\tGive a Day : ");

scanf("%d",&day);

printf("\n");

switch(day)

{


case 1:

{

printf("\tThe given day is Monday.");

break;

}

  case 2:

{

printf("\tThe given day is Tuesday.");

break;

}

case 3:

{

printf("\tThe given day is Wednesday.");

break;

}

case 4:

{

printf("\tThe given day is Thursday.");

break;

}

case 5:

{

printf("\tThe given day is Friday.");

break;

}

  case 6:

{

printf("\tThe given day is Saturday.");

break;

}

case 7:

{

printf("\tThe given day is Sunday.");

break;

}

default:

{

printf("\tInvalid day number");

}

}

printf("\n\n");

printf("\tEnd of Program");

printf("\n\n");

getch();

}


No comments:

Post a Comment