Friday 4 September 2015

WAP to input a number (1 to 7) and print the weekday name according to the given number.

#include<stdio.h>
#include<conio.h>
void main()
{int a;
printf ("enter any numbe rbetween 1 to 7");
scanf("%d",&a);
switch(a)
{case 1:printf("monday");
break;
case 2:printf("tuesday");
break;
case 3:printf("wednessday");
break;
case 4:printf("thusday");
break;
case 5:printf("friday");
break;
case 6:printf("saterday");
break;
case 7:printf("sunday");
break;
default:printf("invalid");
}
getch();
}

No comments:

Post a Comment