samedi 12 août 2017

Expected expression before 'if'

Here is my code, the error code is

Expected expression before 'if'

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

int main()
{

    int friends = 2;

    printf("I have %d friend%s", friends, (if(friends != 1){"s"})
           );

    /*In english you say "friends" when you have 0 or more than one. However if you have 1 you say "friend" without the letter s. I have created a conditional code but there is an error in my print code*/

    return 0;
}

Aucun commentaire:

Enregistrer un commentaire