Advertisement
RupeshAcharya60

Exam Question 2077

Mar 25th, 2023
82
0
Never
Not a member of Pastebin yet? Sign Up, it unlocks many cool features!
text 0.75 KB | Source Code | 0 0
  1. import java.util.Scanner;
  2.  
  3. public class ExamQ {
  4. public static void main(String[] args) throws IOException {
  5. FileOutputStream vowel = new FileOutputStream("Vowel.txt");
  6. FileOutputStream constant = new FileOutputStream("Cons.txt");
  7. Scanner sc = new Scanner(System.in);
  8. System.out.println("Enter the Text:");
  9. String s = sc.nextLine();
  10. for(int i=0;i<s.length();i++){
  11. char temp = s.charAt(i);
  12. if(temp=='a'||temp=='e'||temp=='i'||temp=='o'||temp=='u'||temp=='A'||temp=='E'||temp=='I'||temp=='O'||temp=='U'){
  13.  
  14. vowel.write(temp);
  15. }
  16. else{
  17. constant.write(temp);
  18. }
  19.  
  20. }
  21. vowel.close();
  22. constant.close();
  23. }
  24. }
  25.  
Advertisement
Add Comment
Please, Sign In to add comment
Advertisement