C Quick Refresher

switch...case program
What is the output of the following program?
int main()
{
int totalsales;
int grade;
// Find the output for 7500, 2700 and 9800.
totalsales = 7500;
grade = totalsales/1000;
switch(grade)
{
case 0:
case 1:
case 2:
case 3:
printf("Very Bad");
break;
case 4:
case 5:
case 6:
printf("OK!");
break;
case 7:
case 8:
printf("Good");
break;
case 9:
printf("Fantastic");
break;
}
}


No Comments..!

Change Subject: