jeudi 17 août 2017

Can't see the error [on hold]

For some reason, I can't see where my code is faulty.

#include <stdio.h>
#include <stdlib.h>

int main()
{
    int age;

    printf("How old are you \n");

    scanf("%s", &age);

    if (age > 18){
        printf("You may enter \n");
    }
 /* this above is all that my program runs, always prints "You may enter"*/
  if (age < 18){
        printf("Nothing to see here \n");
    }

    return 0;
}

/thanks/

Aucun commentaire:

Enregistrer un commentaire