In this case you can avoid if..else of switch entirely (but it is a little bit confusing to someone else to read the code):
Code:
// test.c
#include <stdio.h>
int main ( void )
{
static const char * const msgs[] = { "improve", "average", "good", "great", "excellent" };
double a;
int g, offset;
// get the avarage from keyboard...
scanf( "%lf", &a );
g = ( a >= 90.0 );
g += ( a >= 80.0 );
g += ( a >= 70.0 );
g += ( a >= 60.0 );
printf ( "%g: %s\n", a, msgs[g] );
}
Compiling and running:
Code:
$ cc -o test test.c
$ ./test <<< 10
10: improve
$ ./test <<< 62
62: average
$ ./test <<< 73
73: good
$ ./test <<< 81
81: great
$ <<< 99
99: excellent