Consider the following C code
When this code is executed It print statement "Greater than 10"
I don't know why program print that statement inside if , the correct result should be "Less than or equals 10". The condition x + y > 10 evaluates to 10 + (-40) > 10, which simplifies to -30 > 10. This condition is not true, so the program should execute the code inside the else block and print "Less than or equals 10."
C:
#include<stdio.h>
int main (){
unsigned int x = 10 ;
int y = -40;
if(x+y > 10)
{
printf("Greater than 10");
}
else
{
printf("Less than or equals 10");
}
return 0;
}
I don't know why program print that statement inside if , the correct result should be "Less than or equals 10". The condition x + y > 10 evaluates to 10 + (-40) > 10, which simplifies to -30 > 10. This condition is not true, so the program should execute the code inside the else block and print "Less than or equals 10."

