Hi, guys, I wrote this project in VS, it works as it is supposed to. Then I copied the file to UNIX, and after compiling it does not work as it should. When I enter 101 it displays the message and then, unexpectedly says it is grade F. How come? What happened?
I will appreciate your help here...
Oh, one more question. Should I include break after the first 4 "case"'s?Code:#include <stdio.h> main() { int num_grade, tens; printf("Enter numerical grade:"); scanf("%d", &num_grade); if ((num_grade < 0) || (num_grade > 100)) printf("Grade must be positive AND less than 100.\n"); else tens = num_grade / 10; switch (tens) { case 0: case 1: case 2: case 3: case 4: case 5: printf("The grade is F.\n"); break; case 6: printf("The grade is D.\n"); break; case 7: printf("The grade is C.\n"); break; case 8: printf("The grade is B.\n"); break; case 9: printf("The grade is A.\n"); break; case 10: printf("The grade is A.\n"); break; } return 0; }