Code In Tech - The Ultimate World of Computer Technology

Saturday, 24 March 2012

C Program which asks day number and prints corresponding day name

SOURCE CODE:
#include<stdio.h>
#include<conio.h>
void main()
{
 int day;
 clrscr();
 printf("enter day no. :");
 scanf("%d",&day);
 switch(day)
 {

  case 1:printf("\nmonday");break;
  case 2:printf("\ntuesday");break;
  case 3:printf("\nwednesday");break;
  case 4:printf("\nthursday");break;
  case 5:printf("\nfriday");break;
  case 6:printf("\nsaturday");break;
  case 7:printf("\nsunday");break;
  default:printf("\nInvalid input");
  }
getch();
}

No comments :

Post a Comment