5. An instructor has the following grading policy: \"Curving of grades is achiev
ID: 3731602 • Letter: 5
Question
5. An instructor has the following grading policy: "Curving of grades is achieved by adding to every grade the difference between 99 and the highest grade in the class." If following are the grades of the class, grades will be curved by adding 8 (99-91) to each grade: 8, 65, 77, 82,73, 55, 88, 78, 51, 91, 86, 76. Write a program to calculate the grades after they have been curved. Your program should work for any set of grades. You have to store grades initially ROM and then copy from ROM to RAM starting at address 30H for curving the grades.Explanation / Answer
Code :
#include<stdio.h>
void main()
{
// variable declaration
int marks[] = {81,65,77,82,73,55,88,78,51,91,86,76};
int max=0,i,size,curve;
// calculate size of array
size = sizeof(marks)/sizeof(marks[0]);
// find maximum mark
for(i=0;i<size;i++)
{
if(max < marks[i])
max = marks[i];
}
// calculate difference
curve = 99 - max;
// curve grades and then display them
for(i=0;i<size;i++)
{
marks[i] += curve;
printf("%d ",marks[i]);
}
}