Thursday, July 25, 2019

write a c program to check gender male or female.

write a c program to check gender male or female.

check gender male or female



//check gender are you male or femaleusing or(||) Operator.

#include<stdio.h>
#include<conio.h>

void main()
{
char gen;
clrscr();
printf("Are You is a Male(y/n):");
scanf("%c",&gen);

if(gen=='y' || gen=='Y')
{
printf("Male");
}
else if(gen=='n' || gen=='N')
{
printf("Female");
}
else
{
printf("Invalid Choice");
}
getch();


}

Output:




1 comments so far


EmoticonEmoticon