dakata450

Untitled

Jul 3rd, 2022
128
0
Never
Not a member of Pastebin yet? Sign Up, it unlocks many cool features!
text 0.72 KB | None | 0 0
  1. package forCycle;
  2.  
  3. import java.util.Scanner;
  4.  
  5. public class VowelsSum {
  6. public static void main(String[] args) {
  7. Scanner scanner = new Scanner(System.in);
  8. String input = scanner.nextLine();
  9. int sum = 0;
  10.  
  11. for (int i = 0; i < input.length(); i++) {
  12. char symbol = input .charAt(i);
  13.  
  14. if(symbol == 'a'){
  15. sum += 1;
  16. }else if (symbol == 'e'){
  17. sum += 2;
  18. }else if(symbol == 'i'){
  19. sum +=3;
  20. }else if(symbol == 'o'){
  21. sum += 4;
  22. }else if(symbol == 'u'){
  23. sum += 5;
  24. }
  25.  
  26. }
  27. System.out.println(sum);
  28. }
  29. }
Advertisement
Add Comment
Please, Sign In to add comment