Share your repls and programming experiences

← Back to all posts
boy or girl
drAly (2)

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

int main(void)
{
int kids;
char sex;

printf("How many kids do you have?\n");
scanf("%d",&kids);

if(kids==1)
{
    printf("is it boy or girl ?\n");
    printf("use b for boy or g for girl\n");
    scanf("%s",&sex);
    if(sex=='g'||'G')
        printf("you have a little princess. \n");
    else
        printf("you have a little prince.\n");
}
else if(kids==2)
    printf("you have 2 kids .\n");
else
    printf("you have too much kids \n");


return 0;

}