Advertisement
Not a member of Pastebin yet?
Sign Up,
it unlocks many cool features!
- #include<stdio.h>
- int main()
- {
- int p, ch, b, m, c;
- float ptg;
- printf("Physics: ");
- scanf("%d", &p);
- printf("Chemistry: ");
- scanf("%d", &ch);
- printf("Biology: ");
- scanf("%d", &b);
- printf("Math: ");
- scanf("%d", &m);
- printf("Computer: ");
- scanf("%d", &c);
- ptg = ((p+c+b+m+c)/500.0)*100;
- printf("Percentage: %0.2f%% \n", ptg);
- if(ptg >= 90)
- {
- printf("Grade: A \n");
- }
- else if(ptg >= 80)
- {
- printf("Grade: B");
- }
- else if(ptg >= 70)
- {
- printf("Grade: C");
- }
- else if(ptg >= 60)
- {
- printf("Grade: D");
- }
- else if(ptg >= 40)
- {
- printf("Grade: E");
- }
- else if(ptg < 40)
- {
- printf("Grade: F");
- }
- return 0;
- }
Advertisement
Add Comment
Please, Sign In to add comment
Advertisement