java_program 1

  Practical Name: Write a Java Program to display all the vowels form given string

Student Name:  

import java.util.Scanner;

public class VowelFinder

{

public static void main(String args[]) {

Scanner sc=new Scanner(System.in);

System.out.println("Enter an String : ");

String str = sc.next();

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

if(str.charAt(i) == 'a'|| str.charAt(i) == 'e'||

str.charAt(i) == 'i' || str.charAt(i) == 'o' ||

str.charAt(i) == 'u') {

System.out.println("Given string   "+str+"   "+str.charAt(i));

}

}

}

}

Output:


Post a Comment

Previous Post Next Post