Computer Science, asked by roshanimhatre2001, 1 year ago

write a program in vb. net using select case statements to count the number of vovels in a to z alphabet

Answers

Answered by Dineshrathod03
7

Answer:

Module module1

  Sub main()

   Dim char As String

   Console.WriteLine("Enter character:")

   char=Console.ReadLine()

   Select Case char

       case "a","A","e","E","i","I","o","O","u","U"

           Console.WriteLine("Character are vowel")

       case Else

           Console.WriteLine("Not a Vowel")

   End Select

   Console.ReadLine()

   End Sub

End Module

Explanation:

a,e,i,o,u are the vowels

Answered by nancychaterjeestar29
0

Answer:

public class Main{  

   // Functions to check the Vowel

   static boolean isVowel(char ch)

   {

       ch = Character.toUpperCase(ch);

       return (ch=='A' || ch=='E' || ch=='I' ||

                          ch=='O' || ch=='U');

   }

   // Returns count of vowels in string format

   static int countVowels(String str)

   {

       int count = 0;

       for (int i = 0; i < str.length(); i++)

           if (isVowel(str.charAt(i))) // Checking for vowel

               ++count;

       return count;

   }

   public static void main(String args[])

   {

       //object

       String str = "abc de";

       // Total Vowels

       System.out.println(countVowels(str));

   }

}

Time Complexity: O(n)

Auxiliary Space: O(1)

#SPJ2

Similar questions