Advertisement
Not a member of Pastebin yet?
Sign Up,
it unlocks many cool features!
- // Q20 find vowels and consonent in a string
- import java.util.*;
- public class Main
- {
- public static void main(String[] args) {
- Scanner sc= new Scanner(System.in);
- System.out.println("Enter the string");
- String s =sc.nextLine();
- s = s.toLowerCase();
- char c;
- for(int i=0 ; i<s.length() ; i++){
- if(s.charAt(i)=='a'||s.charAt(i)=='e' || s.charAt(i)=='i'||s.charAt(i)=='o'||s.charAt(i)=='u')
- System.out.print("v-"+s.charAt(i)+" ,");
- else
- System.out.print("c-"+s.charAt(i)+" ,");
- }
- }
- }
- /*
- Enter the string
- java
- c-j ,v-a ,c-v ,v-a
- */
Advertisement
Add Comment
Please, Sign In to add comment
Advertisement