Tuesday, 4 December 2012

Program to find given name is either Male or Female



Program to find given name is either Male or Female
           // Male or Female.... 80% ladies name contains vowels at their last


             Console.WriteLine("Enter your Name to get gender");
             string s = Console.ReadLine();
             int len = s.Length;
            char c =s[ len - 1];
            if (c == 'a' || c=='A')
            {
                Console.WriteLine("Female");
            }
            else if (c == 'e' || c=='E')
            {
                Console.WriteLine("Female");
            }
            else if (c == 'i' || c=='I')
            {
                Console.WriteLine("Female");
            }
            else if (c == 'o' || c=='O')
            {
                Console.WriteLine("Female");
            }
            else if (c == 'u' || c=='U')
            {
                Console.WriteLine("Female");
            }
            else
            {
                Console.WriteLine("Male");
            }
             Console.ReadLine();

No comments:

Post a Comment