Else if ladder or multiple else if to check the day corresponding to number in C Language

Introduction: In previous article i explained Else if ladder or multiple else if to check the month of entered number in C language. In this article i will explain how to check the day corresponding to the entered number using ladder else if or we can say multiple else if  in C language.Let's understand by creating a program.

#include<conio.h>
#include<stdio.h>
main()
{
      int num;
      printf("Enter  any number between 1 to 7:  ");
      scanf("%d",&num);
                      if(num==1)
                            {
                            printf("MONDAY");
                            }
                      else if(num==2)
                             {
                            printf("TUESDAY");
                            }
                      else if(num==3)
                            {
                            printf("WEDNESDAY");
                            }
                      else if(num==4)
                           {
                            printf("THURSDAY");
                           }
                     else if(num==5)
                           {
                            printf("FRIDAY");
                           }
                     else if(num==6)
                           {
                           printf("SATURDAY");
                           }
                     else if(num==7)
                            {
                           printf("SUNDAY");
                           }                    
                    else
                           {
                            printf("INVALID NUMBER ...PLEASE ENTER NUMBER BETWEEN 1 TO 7");
                           }
                    getch();
                    }                  
                        
Run the program using Ctrl+F9
                   
Output:
First Run
 Enter any number between 1 to 7: 4
THURSDAY
Second Run
 Enter any number between 1 to 12: 6
SATURDAY
Third Run
 Enter any number between 1 to 12 : 9
INVALID NUMBER ...PLEASE ENTER NUMBER BETWEEN 1 TO 7
Previous
Next Post »

If you have any question about any post, Feel free to ask.You can simply drop a comment below post or contact via Contact Us form. Your feedback and suggestions will be highly appreciated. Also try to leave comments from your account not from the anonymous account so that i can respond to you easily..