Hello all
I have a small problem with these operators as they dont seem to give the answer to what i would expect them to,
any help with a decent explination would be appreciated
Thanx in advance.
Heres my code#include <stdio.h>
int main()
{
int i;
int j;
printf("Enter first number"); /*number entered will be 5 */
scanf("%d", &i);
printf("Enter first number"); /*number entered will be 0 */
scanf("%d", &j);
printf("i < j %d\n", i<j); /*expected answer as 5 is greater than 0 "TRUE therefor 1" */
printf("i <= j %d\n", i<=j); /*expected answer as 5 is greater than 0 "TRUE therefor 1" */
printf("i == j %d\n", i==j); /*expected answer as 5 is not equal to 0 "FALSE therefore 0 */
printf("i > j %d\n", i>j); /*expected answer as 5 is not less than 0 "TRUE 0" */
printf("i >= j %d\n", i>=j); /*expected answer as 5 is not less than or equal to 0 "TRUE 0" */
When the program is run the following output is displayed and I dont understand why ??
Enter no 5
Enter no 0
i > j 0
i <= j 0
i == j 0
i > j 1
i >= j 1
press any key to continue ...
Think my logic here is up the pole but any help would be great
Thanks
GSLR