Logic and examples to show switch case demo in c programming language
switch case program source code #include<stdio.h>
#include<conio.h>
void main()
{
int n;
clrscr();
printf("Enter a no:\n");
scanf("%d",&n);
switch(n)
{
case 1 : printf("One");
break;
case 2 : printf("Two");
break;
case 3 : printf("Three");
break;
case 4 : printf("Four");
break;
case 5 : printf("Five");
break;
case 6 : printf("Six");
break;
case 7 : printf("Seven");
break;
case 8 : printf("Eight");
break;
case 9 : printf("Nine");
break;
default : printf("wrong no");
break;
}
getch();
}
Share This
0 comments: