Friday, July 31, 2009

Help in Turbo C Program for Computing GWA (general weighted average)?

Instructions: Make a program that will compute for the GWA.





I have exams about this tomorrow for 30 points. To compute for the GWA, I have to multiply the grade to the unit (example: Computer Science Grade: 89 Unit: 1.5) the user will be asked to input the grade then the program will multiply it to the unit, add all then divide by all the units.





I hope I don't confuse you. Help will be greatly appreciated. Thanks!





x_O

Help in Turbo C Program for Computing GWA (general weighted average)?
Soupose You Have 5 subject (Math,CS,IT,PHY,CHM)


Now the unit is (1.4,1.5,1.8,1.6,1.2)


so the program will be -----------





int i,totalScore=0,totalUnit=0,scoreArray[5]...


int unitArray[5] = {1.4,1.5,1.8,1.6,1.2}


// now tacking the as input


for(i=0;i%26lt;5;i++){


printf("\n Enter %d th subject grade:");


scanf("%d",%26amp;gradeArray[i]);


}


//now calculate


for(i=0;i%26lt;5;i++){


scoreArray[i] = gradeArray[i]*unitArray[i];


totalScore += scoreArray[i];


totalUnit +=unitArray[i];


}


printf("Avg: %d", totalScore/totalUnit);


No comments:

Post a Comment