Answer to Question #262466 in C for Kitty

Question #262466

Write a program C that prompts the user to input: 4 quizzes, 4 laboratory exercises and 4 assignments in percentage for Class Participation. Class Participation=(avgQuiz+avgLab+avgAssignments)/3 *40%. The user will input the prelim exam. Percentage of PrelimExam=prelimexam*60%. The program should output the Prelim Grade: Prelim Grade = class participation + percentage of Prelim Exam. Put a remarks: if the grade is greater than or equal to 75 display PASSED, otherwise FAILED

SAMPLE RUN:

Class Participation

Quiz 1: 95

Quiz 2: 75

Quiz 3: 87

Quiz 4: 70

Average: 81.75

Lab. 1: 90

Lab. 2: 85

Lab. 3: 88

Lab 4: 80

Average: 85.75

Assignment 1: 80

Assignment 2: 75

Assignment 3: 86

Assignment 4: 95

Average: 84

Class Participation: 33.53

Prelim Exam: 89

%: 53.4

Prelim Grade: 86.93

Remarks: PASSED


1
Expert's answer
2021-11-07T15:54:48-0500
#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 avgQuiz = sum / 4;
	printf("Average: %f\n", avgQuiz);
	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 avgLab = sum_lab / 4;
	printf("Average: %f\n", avgLab);
	
	
	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 avgAssignments = sum_assignment / 4;
	printf("Average: %f\n", avgAssignments);
    
    float class_participation = (avgQuiz + avgLab + avgAssignments) / 3 * 0.4;
    printf("Class Participation:  %f\n", class_participation);
    printf("Enter the Preliminary Exam\n");
    float exam;
    scanf("%f", &exam);
    float PrelimExam=exam*0.6;
    printf("Preliminary is :  %f\n", PrelimExam);
    float total = PrelimExam + class_participation;
    printf("Prelim Grade :  %f \n", total);
    if(total>=75){
    	printf("Remark :  PASSED \n");
	}
	else{
		printf("Remark :  FAILED \n");
	}
	 
}

Need a fast expert's response?

Submit order

and get a quick answer at the best price

for any assignment or question with DETAILED EXPLANATIONS!

Comments

No comments. Be the first!

Leave a comment

LATEST TUTORIALS
New on Blog
APPROVED BY CLIENTS