Hello all, I'm doing a C challenge where the intent is to get an average GPA from 10 GPA inputs. I am still a noob, only about two weeks into C programming so this could be a simple problem I'm running into. Essentially my float inputs are saving as 0.0 instead on inputted user values. Does anyone have any suggestions and further more an explanation on why this is happening to me? I've removed the math of getting the GPA average because I need to solve this problem first, so that will not be in the code. the code is below.
#include <stdio.h>
//Function prototypes
char cBreak(void);
//start main func
main(){
float iArray[20];
int iIndexPos = 0;
float fGPA = 0;
int iTotalGPA = 0;
cBreak();
printf("\nGPA Average Calculator\n");
printf("\nDescription:");
printf("\nUsing this program, you can calculate an average GPA of up to 10 inputs.");
cBreak();
for(iIndexPos = 0; iIndexPos <= 9; iIndexPos++){//start for, keep track of index position to set element values
if(iIndexPos == 0){
printf("\nPlease enter your %dst GPA:", iIndexPos + 1);
scanf(" %.2f", &iArray[iIndexPos]);
}
else if(iIndexPos == 1){
printf("\nPlease enter your %dnd GPA:", iIndexPos + 1);
scanf(" %f", &iArray[iIndexPos]);
}
else if(iIndexPos == 2){
printf("\nPlease enter your %drd GPA:", iIndexPos + 1);
scanf(" %f", &iArray[iIndexPos]);
}
else if(iIndexPos >= 3){
printf("\nPlease enter your %dth GPA:", iIndexPos + 1);
scanf(" %f", &iArray[iIndexPos]);
}
}// end for
for(iIndexPos = 0; iIndexPos <= 9; iIndexPos++){//used to find out how many gpas to average
if(iArray[iIndexPos] > 0.1){
iTotalGPA++;
}
}
for(iIndexPos = 0; iIndexPos <= 9; iIndexPos++){
printf("%.1f", fGPA);
}
}
//function definition
char cBreak(void){
printf("\n_________________________________________________________________________\n");
}```