hello everyone
ı have a problem with writing the program
#include <stdio.h>
int main(void)
{
char desiredgrade; double score;
double currentaverage;
double weight;
printf("Enter your desired grade");
scanf("%c,&desiredgrade");
printf("Enter your current average in the course");
scanf("%f,¤taverage");
printf("Enter the final exam weight\n");
printf("as a percentage of the course grade");
scanf("%lf,&weight");
if ( 90<=desiredgrade && desiredgrade<=100)
{
score =(desiredgrade-(currentaverage*(100-weight)/100)+(100/weight));
printf("You need a score of %.2f on the final to get A\n",score);
}
else if (80<=desiredgrade && desiredgrade<=90)
{
score=(desiredgrade-(currentaverage*(100-weight)/100)+(100/weight));
printf("You need a score of %.2f on the final to get B\n",score);
}
else if (70<=desiredgrade && desiredgrade<=80)
{
score=(desiredgrade-(currentaverage*(100-weight)/100)+(100/weight));
printf("You need a score of %.2f on the final to get C\n",score);
}
else if (60<=desiredgrade && desiredgrade<=70)
{
score=(desiredgrade-(currentaverage*(100-weight)/100)+(100/weight));
printf("You need a score of %.2f on the final to get D\n",score);
}
return 0 ;
}
ı wrote the program like that but program give me 3 warning which are;
warning C4700: local variable 'desiredgrade' used without having been initialized
: warning C4700: local variable 'weight' used without having been initialized
: warning C4700: local variable 'currentaverage' used without having been initialized
please help me
ı had to wirite a program that predicts the score needed on a final exam to achieve a desired grade in a course