Hey guys i have been working on a report card program lately and i hit a hard place i used a do-while but i cant restrict characters from being posted without the program crashing and i don't wanna be monotamous so can u guys help heres a piece of the code

phys: // this is the report error system//

 do {

               printf ("Input physics grade :\n");
                scanf("%f", &phys );


                 if (phys > 100|| phys <0) {

                     printf("Skipping the value\n");
                     fflush(stdin);
                      continue;
                      /* jumps to second iteration */

                 }

this is a part of my code so could you help me?

fflush(stdin) is like trying to flush your kitchen sink.

Flushing only works on output streams (like the toilet in your home), not on input streams, like your kitchen faucet. ;)

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.