Using If ,else in one line

 #include<stdio.h>


int main(){

    int a;

    printf("Enter a\n");

    scanf("%d", &a);

    // One liner

    (a < 5) ? printf("A is less than 5") : printf("A is not less than 5");

     return 0;

}

Comments

Popular posts from this blog

Snake game.c

Type declaration

Array with function