Answer to Question #275526 in C for Ken

Question #275526

Create a C program that will be able to compute the prelim grade up to finals grade of a certain student.

Note: (Only the prelim grade, midterm grade and final grade will be entered.)

Specification:

Total Grade= (Prelim Grade *.30)+(Midterm Grade*.30) + (Final Grade*.40)

Equivalent:

98-100 1.00 83-85 2.25

95-97 1.25 80-82 2.50

92-94 1.50 77-79 2.75

89-91 1.75 75-76 3.00

86-88 2.00

74 and below 5.00

Remarks: (note: separate the condition of remarks to equivalent)

Pass>=75 Failed<=74



1
Expert's answer
2021-12-04T10:19:28-0500


#include <stdio.h>




// Driver code
int main() {
	float totalGrade;
	float prelimGrade;
	float midtermGrade;
	float finalGrade;


	
	printf("Enter Prelim Grade: ");
	scanf("%f",&prelimGrade);
	printf("Enter Midterm Grade: ");
	scanf("%f",&midtermGrade);
	printf("Enter Final Grade: ");
	scanf("%f",&finalGrade);
	totalGrade= (prelimGrade *.30)+(midtermGrade*.30) + (finalGrade*.40);


	//98-100 1.00 
	if(totalGrade>=98 && totalGrade<=100){
		printf("Prelim grade: 1.00\n");
	}
	//83-85 2.25
	if(totalGrade>=83 && totalGrade<=85){
		printf("Prelim grade: 2.25\n");
	}
	//95-97 1.25 
	if(totalGrade>=95 && totalGrade<=97){
		printf("Prelim grade: 1.25\n");
	}
	//80-82 2.50
	if(totalGrade>=80 && totalGrade<=82){
		printf("Prelim grade: 2.50\n");
	}
	//92-94 1.50 
	if(totalGrade>=92 && totalGrade<=94){
		printf("Prelim grade: 1.50\n");
	}
	//77-79 2.75
	if(totalGrade>=77 && totalGrade<=79){
		printf("Prelim grade: 2.75\n");
	}
	//89-91 1.75 
	if(totalGrade>=89 && totalGrade<=91){
		printf("Prelim grade: 1.75\n");
	}
	//75-76 3.00
	if(totalGrade>=75 && totalGrade<=76){
		printf("Prelim grade: 3.00\n");
	}
	//86-88 2.00
	if(totalGrade>=86 && totalGrade<=88){
		printf("Prelim grade: 2.00\n");
	}
	//74 and below 5.00
	if(totalGrade<=74 ){
		printf("Prelim grade: 5.00\n");
	}
	//Pass>=75 Failed<=74
	if(totalGrade>=75){
		printf("\nPass\n\n");
	}else{
		printf("\nFailed\n\n");
	}




	getchar();
	getchar();
	return 0;
}

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