Who can spot what I did wrong?
Write a function qualityPoints that inputs a student's average and returns 4 if a student's average is 90-100, 3 if the average is 80-89, 2 if the average is 70-79, 1 if the average is 60-69, and 0 if the average is lower than 60.
Code:
#include <stdio.h>
int qualityPoints(int a, int b, int c, int d, int f);
int main() {
int x;
int q;
int a;
int b;
int c;
int d;
int f;
printf("Enter student's average grade:", x);
scanf("%d", &x);
q = qualityPoints(a, b, c, d, f);
printf("Student's average is between %d", q );
return 0;
}
int qualityPoints(int a,int b, int c, int d, int f) {
for(a = 100; a >= 90; a--){
if(a >= 90)
return 4;
}
for(b = 89; b >= 80; b--){
if(b >= 80)
return 3;
}
for(c = 79; c >= 70; c--){
if(c >= 70)
return 2;
}
for(d = 69; d >= 60; d--){
if(d >= 60)
return 1;
}
for(f = 59; f >= 0; f--){
if(f < 60)
return 0;
}
}
What do I have wrong?