Drop Down MenusCSS Drop Down MenuPure CSS Dropdown Menu

Monday, 6 June 2016

PROBLEM 40:
Take obtained marks of a student out of 100 as input and print the grade as per following rules.
(Use both a) Positive and b) Negative Logic):
Obtained Marks
Grade
Between and including 50 and 60
D
Between and including 61 and 70
C
Between and including 71 and 80
B
Between and including 81 and 90
A-
Between and including 91 and 100
A+

Code:
#include<stdio.h>
main()
{
    // Variable declaration//
    int marks;
   /*Input*/
    printf("enter your marks:");
    scanf("%d",&marks);
     /* actual Working */
    if(marks>=50 && marks<=60)
    {
        printf("your grade is D");
    }
    else if(marks>=61 && marks<=70)
    {
        printf("your grade is C");
    }
    else if(marks>=71 && marks<=80)
    {
        printf("your grade is B");
    }
    else if(marks>=81 && marks<=90)
    {
        printf("your grade is A");
    }
    else if(marks>=91 && marks<=100)
    {
        printf("your grade is A+");
    }
    else
    {
        printf("invalid");
    }
    return 0;

}

Program Output:






For more problems click here

No comments:

Post a Comment