Answer to Question #255949 in C for discover

Question #255949

Create a C program that will accept student name, prelim grade, midterm grade and final grade then compute and display for cumulative grade based on the formula: CG=15% of prelim + 30% midterm + 55% final. Your program should display the output based on the following sample run.

Sample Run:

Enter student name:

Prelim grade:

Midterm grade:

Final grade:

Cumulative grade:


1
Expert's answer
2021-10-24T11:56:15-0400


#include<conio.h>
#include<stdio.h>
#include<stdlib.h>




int main(){
	char name[20];
	double prelimGrade,midtermGrade,finalGrade,cumulativeGrade;
	printf("Enter student name: ");
	gets(name);
	printf("Prelim grade: ");
	scanf("%lf",&prelimGrade);
	printf("Midterm grade: ");
	scanf("%lf",&midtermGrade);
	printf("Final grade: ");
	scanf("%lf",&finalGrade);
	//compute and display for cumulative grade based on the formula: CG=15% of prelim + 30% midterm + 55% final.
	cumulativeGrade=0.15*prelimGrade+0.3*midtermGrade+0.55*finalGrade;
	printf("Cumulative grade: %.2f\n",cumulativeGrade);


	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