logo
logo

Get in touch

Awesome Image Awesome Image

Development April 14, 2014

C Program To Predict The Gender of A Person With Name

Writen by Taeyaar Support

comments 0

This program predicts the gender of a person with his/her Name

logic: This program compares the last characters of the string with names

Program :

#include<stdio.h>
#include<string.h>
int main()
{

char s[100],c;
m:
system(“cls”);
b:
printf(“enter the name (in lower case) :”);
scanf(“%s”,s);
if(strlen(s)>=3)
{
if(s[strlen(s)-1]==s[strlen(s)-2])
{
printf(“nnenter a valid namenn”);
goto b;
}
if(s[(strlen(s))-1]==’i’||s[(strlen(s))-1]==’u’||s[strlen(s)-1]==’a’||s[strlen(s)-4]==’d’||s[strlen(s)-1]==’i’)
{
printf(“nn%s is female”,s);
}
else
{
printf(“nn%s is male”,s);
}
}
else
{
printf(“nnenter a valid namenn”);
goto b;
}
printf(“nndo u want to continue(y/n):”);
fflush(stdin);
scanf(“%c”,&c);
if(c==’y’)
{
goto m;
}
}

Lakshman is the founder of TrickyTrickzz. He is a Tech Geek, SEO Expert, Web Designer Who Likes Doing Cool And Creative Things Regardless Of What Medium He’s Working In. Contact Him Here

Follow him On Google+ | Facebook | Twitter

Tags : ,