# Problem with calculations

• 03-03-2005
3901LV
Problem with calculations
This program should allow you to enter the percentage desired
at the end of a course, the total number of points in the
course, the points earned to date, and the total points to
date. The program should then calculate and display:
1) the number of the remaining points in the class needed to
earn the desired percentage
2) the percentage of the remaining points needed to earn the
desired percentage in the course.

1) Percentage desired
2) Total points in the course
3) Points earned to date
4) Total points to date

Heres is what I have got so far. I am not sure how to convert the formula over to C code

#include <stdio.h>
int main ()
{
float percent;
int totalpoints;
int earnedpoints;
int totaltodate;
printf("Enter Percentage Desired:");
scanf (" %d", & percent);
printf("Enter Total points in the course:");
scanf ("%d",& totalpoints);
printf("Enter Total points earned to date:");
scanf("%d ", &earnedpoints);

printf("Enter Total points to date:");
scanf("%d",&totaltodate);
• 03-03-2005
pianorain

The first step would be to write out the formulas using standard math. Then coding it in C is pretty simple.
• 03-03-2005
Krak
Damn! Beaten.

I think it'd also be a better idea if the program calculated the % for you....

Code:

```#include <stdio.h>   int main(){   float curPoints;   float maxPoints;   float percent;     printf("Enter your current points:\t");     scanf("%f",&curPoints);     printf("\nNow enter the max points possible:\t");     scanf("%f",&maxPoints);     percent = (curPoints/maxPoints) * 100;     printf("\nHey, you have a %f percent, guy!",percent); return 0; }```
Just use some good ol' math, honey. Also...it seems that you're entering a value for "total points"...twice?

totalpoints and totaltodate?