The first two conditions for 100<a<200 and 100<b<200 are executing perfectly but the condition for both to be between 100 and 200 is not working any idea why? My code:
#include<stdio.h>
int main()
{
int a,b;
printf("Enter the first integer:");
scanf("%d",&a);
printf("Enter the second integer:");
scanf("%d",&b);
if (100<=a&&a<=200)
{printf("The integer %d lies between 100 and 200",a);}
else if (100<=b&&b<=200)
{printf("The integer %d lies between 100 and 200",b);}
else if((100<=a&&a<=200)&&(100<=b&&b<=200))
{printf("Both of the integers lie between 100 and 200");}
else
{printf("The integers does not lie between 100 and 200");}
return 0;
}
Output: enter image description here
If for example the condition in the if statement
evaluates to logical true then other if-else statements will not be executed including this if statement
You need to start your if-else statement from this statement