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)
{
  char desiredgrade;
  double min_average;
  double currentaverage;
  double weight;
  double score;
  printf("Please enter your desired grade: \n");
  scanf("%c", &desiredgrade);
  printf("Please enter your minimum average required:  \n");
  scanf("%lf", &min_average);
  printf("Please enter your current average in course:  \n");
  scanf("%lf", &currentaverage);
  printf("Please enter how much the final counts as a percentage of the course grade:  \n");
  scanf("%lf", &weight);
  if ( 92<=desiredgrade && desiredgrade>=100)
{
  score=(min_average-(100-weight)(currentaverage/100)+(100/weight));
  printf("You need a score of %.2f on the final to get A\n",score);
}
  else if (84<=desiredgrade && desiredgrade>=91)
{
  score=(min_average-(100-weight)(currentaverage/100)+(100/weight));
  printf("You need a score of %.2f on the final to get B\n",score);
}
  else if (76<=desiredgrade && desiredgrade>=83)
{
  score=(min_average-(100-weight)(currentaverage/100)+(100/weight));
  printf("You need a score of %.2f on the final to get C\n",score);
}
  else if (68<=desiredgrade && desiredgrade>=75)
{
  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 ;
}

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 read input.
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 Desired grade: B
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 Desired grade: B
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)
{
  char desiredgrade;
  double min_average;
  double currentaverage;
  double weight;
  double score;
  printf("Please enter your desired grade: \n");
  scanf("%c", &desiredgrade);
  printf("Please enter your minimum average required:  \n");
  scanf("%lf", &min_average);
  printf("Please enter your current average in course:  \n");
  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
Please enter your minimum average required:
79.5
Please enter your current average in course:
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.

Edited 3 Years Ago by Dani: Formatting fixed

This article has been dead for over six months. Start a new discussion instead.