Translate

Tuesday, May 5, 2020

C Program to Print Day Name of Week using Else If ladder

#include<stdio.h>
#include<stdio.h>
void main()
{
    int ch;
    
    printf("\n1. press ch=1 for monday. \n2. press ch=2 for tuesday.\n3. press ch=3 for wednesday. \n4.press ch=4 for thursday. \n5.press ch=5 for friday.\n6.press ch=6 for saturday. \n7. press ch=7 for sunday.");
    printf("\n enetr your choice =");
    scanf("%d", &ch);
    if(ch==1)
    {
        printf("today is monday");
    }
  else if(ch==2)
    {
       printf("today is tuesday");
    }
 else if(ch==3)
    {
       printf("today is wednesday");
    }
 else if(ch==4)
    {
        printf("today is thursday");
    }
  else if(ch==5)
    {
        printf("today is friday");
    }
  else  if(ch==6)
    {
        printf("today is saturday");
    }
  else if(ch==7)
    {
        printf("today is sunday");
    }
    getch();
    
}
Output:

No comments:

Post a Comment

C program to make a calculator using the switch statement.

/*perform arithmetic calculation on integers in C language*/ #include<stdio.h> #include<conio.h> void main() {     char op;     ...