Problem Statement :-
Write a program to print the smallest vowel in a given string ......
Input :
Matrix
output :
a
Explanation :
   The vowels in the given string are a and i. And the alphabetically smallest between them        is a.
Video Link : Click here to watch video on youtube
Code :
import java.util.Scanner;
public class Solution4 {
    public static void main(String[] args) {
        Scanner sc =new Scanner(System.in);
        String word=sc.nextLine();
        String vowels[]={"a","e","i","o","u"};
        for(int i=0;i<vowels.length;i++){
            if(word.contains(vowels[i])){
                System.out.println(" Smallest Vowel : "+vowels[i]);
                break;
            }
        }
    }
}
Thank You ..... Subscribe the Channel ....

Comments
Post a Comment