Vowels counts In C#

using System;

namespace VOWELS_count
{
    class vowels
    {
        string name;
        public int check = 0;
       public  string  user_input()
        {


            Console.WriteLine("ENTER YOUR NAME");
            name = Console.ReadLine();
        return name;
        }
         public int  check_v()
         {
            foreach(char vowel in name)
            {
            if (vowel == 'a' || vowel == 'A' || vowel=='e' || vowel=='E' ||
                vowel == 'i'|| vowel == 'I' || vowel== 'o' || vowel=='O' ||
                vowel == 'u' || vowel =='U')
           
            {
         check++;
            }
            }
             return check;
         }

        static void Main(string[] args)
        {
            vowels a = new vowels();

            Console.WriteLine("Here is your vowels code");
            string m;
            int b;
            m = a.user_input();
            b = a.check_v();

            Console.WriteLine("vowels present :{0}",b);
            Console.ReadKey();
        }
    }
}






No comments:

Post a Comment