c - Simple 'else if' statement is not working -
this question has answer here:
- a>=b>=c operators in c? [duplicate] 4 answers
#include <stdio.h> #include <stdlib.h> int main() { int age; printf("hello world! please enter age\n"); scanf("%d", &age); if (age <= 50) { printf("you still young change world\n"); } else if (70 >= age >50) { printf("you old, don't worry\n"); } else { printf("you extremely old\n"); } return 0; }
i entered age 51 , gives "you extremely old". else if
statement not working.
else if ( 70>=age>50 ){
in c not how this. instead try -
else if (age>50 && age <=70){ // age in between 50 , 70(including)
Comments
Post a Comment