Switch Statements

Switch Statements - break case 8:case 9:case 10...

Info iconThis preview shows page 1. Sign up to view the full content.

View Full Document Right Arrow Icon
// This program demonstrates switch statements #include <stdio.h> void main() { int num; printf("Enter a number from 1 to 10 "); scanf("%d",&num); switch(num) { case 1: printf("Low\n"); break; case 2: printf("Low\n"); break; case 3: printf("Low\n"); break; case 4:case 5:case 6:case 7: printf("Medium\n");
Background image of page 1
This is the end of the preview. Sign up to access the rest of the document.

Unformatted text preview: break; case 8:case 9:case 10: printf("High\n"); break; default: printf("Invalid\n"); //done if no matching case label } } /* Enter a number from 1 to 10 5 Medium Press any key to continue . . . */...
View Full Document

{[ snackBarMessage ]}

Ask a homework question - tutors are online