November 22, 2024

To print weekdays based on user choice in ‘C’

#include<stdio.h>
#include<conio.h>

void main ( )
{
   int d;
  printf("enter choice");
  scanf("%d,&d);
   switch ( c )
   {
case 1:
  printf("The day is Sunday");
break;

case 2 :
  printf("The day is Monday");
break;

case 3 :
  printf("The day is Tuesday");
break;

case 4 :
  printf("The day is Wednesday");
break;

case 5 :
  printf("The day is Thursday");
break;

case 6 :
  printf("The day is Friday");
break;

case 7:
  printf("The day is saturday");
break;

default:
printf("wrong choice");
}
getch( );
}

Leave a Reply

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