hello,
I actually wants to print my "invalid" to the user when they enter letters because supposedly they enter integers between 0 and 10,but i tried and when i ran it by entering a letter,it went wrong,this is my code
Thanks for your kindness
Code:
#include<stdio.h>
int main()
{
int trial=0;
float judge1=0,judge2,judge3,judge4,judge5;
char a;
printf("\n%90s","Welcome to the constentant score calculator program :)");
printf("\n\n\n\n\n\rKindly enter the constentant score by 5 respected judges:");
do
{
printf("\n\nScore by JUDGE 1 (0-10):\t");
scanf("%f",&judge1);
if ((judge1>-1)&& (judge1<11) )
printf("The constentant got %.2f from the judge",judge1);
else
printf("\aPlease input a valid score between 0 and 10:");
} while ((judge1<0) || (judge1>10)||(judge1=a>96) && (judge1=a<123)||(judge1=a<91) && (judge1=a>64));
}
#include<stdio.h>
int main()
{
int trial=0;
float judge1,judge2,judge3,judge4,judge5;
char char1;
printf("\n%90s","Welcome to the constentant score calculator program :)");
printf("\n\n\n\n\n\rKindly enter the constentant score by 5 respected judges:");
do
{
printf("\n\nScore by JUDGE 1 (0-10):\t");
scanf("%f",&judge1);
if ((judge1<0)|| (judge1>10) || (judge1==char1>96) || (judge1==char1<123) || (judge1==char1<91) || (judge1==char1>64))
printf("\aPlease input a valid score between 0 and 10:");
else
printf("The constentant got %.2f from the judge",judge1);
} while ((judge1<0)|| (judge1>10) || (judge1==char1>96) || (judge1==char1<123) || (judge1==char1<91) || (judge1==char1>64));
}