here is my code i get an error of call of non function in lines 29, 34, 39 and 44

apprecite help or an alternate code if possible

here is code

``````int main (void)
{
double min_average;
double currentaverage;
double weight;
double score;
scanf("%lf", &min_average);
scanf("%lf", &currentaverage);
printf("Please enter how much the final counts as a percentage of the course grade:  \n");
scanf("%lf", &weight);
{
score=(min_average-(100-weight)(currentaverage/100)+(100/weight));
printf("You need a score of %.2f on the final to get A\n",score);
}
{
score=(min_average-(100-weight)(currentaverage/100)+(100/weight));
printf("You need a score of %.2f on the final to get B\n",score);
}
{
score=(min_average-(100-weight)(currentaverage/100)+(100/weight));
printf("You need a score of %.2f on the final to get C\n",score);
}
{
score=(min_average-(100-weight)(currentaverage/100)+(100/weight));
printf("You need a score of %.2f on the final to get D\n",score);
return 0 ;
}
return score ;
}``````

## All 6 Replies

You need some kind of operator between these brackets. Probably the multiplication operator. `(a)(b)` doesnt mean `a * b` like in algebra.

``score=(min_average-(100-weight)(currentaverage/100)+(100/weight));``

then that makes my formula wrong then
that is correct formula

If that doesnt correct your problem write me the Correct Formula mathematically. Use +,-,*,/ only. Don't use any implicit operators.

Purpose: To determine data requirements.
To process and output data.
To document a program.

Program: Write a program that predicts the score needed on a final exam to achieve a desired grade in a course. The program should interact with the user as follows:
Enter minimum average required: 79.5
Enter current average in course: 74.6
Enter how much the final counts as a percentage of the course grade: 25

You need a score of 94.20 on the final to get a B.

[79.5 - 75(.746)] * 4

this is waht his example works out to i need the formula

Enter minimum average required: 79.5
Enter current average in course: 74.6
Enter how much the final counts as a percentage of the course grade: 25

You need a score of 94.20 on the final to get a B.
[79.5 - 75(.746)] * 4

Here is a much more smaller program that gives you the required output. No check is done for Desired grade checking. You do that.

``````#include <stdio.h>

int main (void)
{
double min_average;
double currentaverage;
double weight;
double score;
scanf("%lf", &min_average);
scanf("%lf", &currentaverage);
printf("Please enter how much the final counts as a percentage of the course grade:  \n");
scanf("%lf", &weight);
score=(min_average-((100-weight)*(currentaverage/100)))*(100/weight);
printf("You need a score of %.2f on the final to get %c\n",score, desiredgrade);

return 0;
}``````

My output

``````Please enter your desired grade:
B
79.5
74.6
Please enter how much the final counts as a percentage of the course grade:
25
You need a score of 94.20 on the final to get B``````

Yes you better follow the guidelines laid down by Wolfpack to solve your problem but while finalizing your code just replace the `scanf` with either `getchar ()` for gettign a character or `fgets ( )` while getting a string.

`scanf` is a prettly complex function and leaves the input stream dirty with the junk.

Hope it helped, bye.

Be a part of the DaniWeb community

We're a friendly, industry-focused community of developers, IT pros, digital marketers, and technology enthusiasts meeting, networking, learning, and sharing knowledge.