Powered by Blogger.

Tuesday, March 19, 2013

16.Print result sheet by using switch statement:

#include<stdio.h>
int main()
{
    int score,grade;
    printf("\n Enter your score to test grade:");
    scanf("%d",&score);
    grade=score/10;
    switch (grade)
    {
        case 10:
        case  9:
        printf("\n your grade is A.\n");
        break;
        case  8:
        printf("\n your grade is B.\n");
        break;
        case  7:
        printf("\n your grade is C.\n");
        break;
        case  6:
        printf("\n your grade is D.\n");
        break;
        default:
        printf("\n your grade is F.\n");
        break;
    }
    return 0;
}

0 comments:

Post a Comment