93.7k views
3 votes
Write a C program to do the following tasks:

a) Read the grades of students in the class from the keyboard (assume the grades are

integer in the range 0 to 100).

b) Find the average of the grades that are less than 50. If there are no grades less than 50, then display the message "No grades < 50".

c) Find the average of the grades that are greater than or equal 50. If there are no

grades greater than or equal to 50, then display the message "No grades >= 50".


The program should terminate if the input grade is negative. (Hint: Use sentinel-controlled repetition structure). Note that average of the grades might not be an integer and design your program considering that

1 Answer

12 votes

Answer:

#include<stdio.h>

void main()

int marks;

printf("Enter your marks ");

scanf("%d",&marks);

if(marks<0 || marks>100)

printf("Wrong Entry");

else if(marks<50)

printf("Grade F");

else if(marks>=50 && marks<60)

printf("Grade D");

else if(marks>=60 && marks<70)

printf("Grade C");

else if(marks>=70 && marks<80)

printf("Grade B");}

else if(marks>=80 && marks<90)

printf("Grade A");

else:

printf("Grade A+");

#may need to replace spaces with tab

Step-by-step explanation:

it works ( I hope, if it doesn’t tell me what the error is)

User Misanthrop
by
5.5k points