Getting wrong message for function


if (a <= 800 && a >= 200){
ansa = true;
}
Last edited on
I suspect that the issue here is the number of parenthesis that you included. Try encompassing the <= and >= comparisons with parenthesis themselves and see if that makes a difference. By <= and >= comparisons, I mean rewrite (a <= 800 && a >= 200) to ((a <= 800) && (a >= 200))
Last edited on
Still says it's valid even though it shouldn't be.
1
2
3
4
5
6
7
8
Enter 1000 for the first value to end this program
Enter First Score: -30
Enter Second Score: 40
Enter Third Score: 50
-30 is invalid
40 is invalid
50 is invalid
this group is valid
A single line of code may not be enough to figure out the problem. I think you need to show the complete code so we can see the way it will behave.
Topic archived. No new replies allowed.