Hey guys, I'm trying to write a gradebook program in C but I can't get to validate the grades... help please!

float notas[5];
int x=0;
char opcion1;


for(x=0; x<5;x++){
         
         do   { 
              printf("Ingrese nota %d: ", x+1);
              scanf("%f", &notas[x]);
              }
         while (notas[x]>100 && notas[x]<0);}

The user must enter 5 grades. If one of them isn't between 0 to 100, the user must add another grade.

Your loop states while (notas[x]>100 && notas[x]<0);} . Can this ever be true? Read your condition very carefully with notas[x] qual to -10, 50, and 110. Write out a truth table to see what happens.

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.