>> if ( isdigit(iNumber) > 10 || < 1 )
Do be sure to look up the documentation on a function before you use it. Anyway, isdigit expects a *character* value and returns true or false (1 or 0). As it turns out you don't need the function at all here, just a straight comparison:
Code:
if ( iNumber > 10 || iNumber < 1 )
Next, this statement:
Code:
printf("The correct guess was %d\n", iAnswer);
If you want it to execute on the else condition, you'll need to enclose everything from the block in brackets, eg:
Code:
if ( iNumber > 10 || iNumber < 1 )
{
printf("Enter a number between 1 and 10");
}
else
{
if (iNumber == iAnswer)
{
printf("\nYou guessed right!\n");
}
else
{
printf("\nSorry, you guessed wrong\n");
printf("The correct guess was %d\n", iAnswer);
}
}
EDIT: Ah, now I see isdigit is part of the requirements. In that case, declare a character and pass it to scanf with the %c format specifier.