Answer by Vasilis Samaras for OR and less than operators not working as...
if (v || u <= 0) considers v as a boolean variable so it is true for every non zero value. So your if is true for any non zero v. Use if (v <= 0 || u <= 0)
View ArticleAnswer by Govind Parmar for OR and less than operators not working as...
if (v || u <= 0) is not saying "if v is less than or equal to zero OR if u is less than or equal to zero", like I believe you think it is. It's actually saying "if v is not zero, OR u is less than...
View ArticleOR and less than operators not working as intended C language
I'm doing an exercise of a book called programming in C language, trying to solve exercise 7.9 and so my code works perfectly until I add a conditional statement for the function to only accept...
View Article
More Pages to Explore .....