logoISU  

CS256 - Principles of Structured Design

Fall 2021

Displaying ./code/sternflCode/h3/grade.c

/*

grade.c - enter points earned and points possible, 
		  displays the users percent and grade.

		  Use the grading scale below:
		  A - 90
		  B - 80
		  C - 70
		  D - 60
		  Below 60 is an F


*/

#include <stdio.h>

int main(){

	//variable declarations
	float earned, possible, total;

	//ask how many points did the student get
	printf("How many points did this student earn?> ");
	scanf("%f", &earned); //using scanf to get the value

	//asking how many points were possible,
	printf("How many points were possible?> "); 
	scanf("%f", &possible); //using scanf to get that value

	total = 100 * (earned/possible); //calculate the total, then multiply by 100
									 //to get the percent value

	printf("The student got a %.2f percent\n", total); //print the percent value

	//now do the if-else statements here for the value in "total"
	//Using the grading scale above	 print what grade the student got
	//Make it resemble the output you'd get from the grade program in the "working"
	//directory

	

	return 0;

}