c - Simple 'else if' statement is not working -


this question has answer here:

#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

Popular posts from this blog

sublimetext3 - what keyboard shortcut is to comment/uncomment for this script tag in sublime -

java - No use of nillable="0" in SOAP Webservice -

ubuntu - Laravel 5.2 quickstart guide gives Not Found Error -