C program to display use of break statement in switch case.

Syntax - break;
Example-
use of break in switch case

#include<stdio.h>
#include<conio.h>
void main(){
int day;
Clrscr();
printf("Enter day number\n");
scanf("%d",&day);
switch (day) {
case 1: printf("monday"); break;
case 2: printf("tuesday"); break;
case 3: printf("wednesday"); break;
case 4: printf("thursday"); break;
case 5: printf("friday"); break;
case 6: printf("saturday"); break;
case 7: printf("sunday"); break;
default:
printf("wrong input\ntry again!!\n");
}
getch();
}

Output-
Enter day number
3
Wednesday 

No comments:

Post a Comment