SAMPLE RUN:
Class Participation
Quiz 1: 90
Quiz 2: 95
Quiz 3: 89
Quiz 4: 80
Average: 88.5
Lab. 1: 100
Lab. 2: 95
Lab. 3: 80
Lab 4: 70
Average: 86.25
Assignment 1: 100
Assignment 2: 80
Assignment 3: 89
Assignment 4: 75
Average: 86
Class Participation: 34.73
Prelim Exam: 95
%: 57.00
Prelim Grade: 91.73
Remarks: PASSED
#include<stdio.h>
int main(){
printf("Class Participation\n");
int i;
float sum = 0.0;
for(i=0; i<4; i++){
printf("Quiz %d: ", (i+1));
float quiz;
scanf("%f", &quiz);
sum += quiz;
}
float average = sum / 4;
printf("Average: %f\n", average);
int n;
float sum_lab = 0.0;
for(n=0; n<4; n++){
printf("Lab. %d: ", (n+1));
float lab;
scanf("%f", &lab);
sum_lab += lab;
}
float average_lab = sum_lab / 4;
printf("Average: %f\n", average_lab);
int j;
float sum_assignment = 0.0;
for(j=0; j<4; j++){
printf("Assignment %d: ", (j+1));
float assignment;
scanf("%f", &assignment);
sum_assignment += assignment;
}
float average_assignment = sum_assignment / 4;
printf("Average: %f\n", average_assignment);
float class_participation = (average_assignment + sum_assignment + average) * 0.4;
printf("Prelim Exam: %f\n", class_participation);
float exam;
scanf("%f", &exam);
float total = class_participation + (exam * 0.6);
}
Comments
Leave a comment