Advertisement
dimipan80

C#Exams 2. Illuminati (on Java Code)

Aug 22nd, 2014
295
0
Never
Not a member of Pastebin yet? Sign Up, it unlocks many cool features!
Java 0.56 KB | None | 0 0
  1. import java.util.Scanner;
  2.  
  3. public class _2_Illuminati {
  4.  
  5.     public static void main(String[] args) {
  6.         // TODO Auto-generated method stub
  7.         Scanner scan = new Scanner(System.in);
  8.         String message = scan.nextLine().toUpperCase();
  9.  
  10.         int vowelsCounter = 0;
  11.         int sumOfVowels = 0;
  12.         char[] messageArr = message.toCharArray();
  13.         for (char ch : messageArr) {
  14.             if (ch == 65 || ch == 69 || ch == 73 || ch == 79 || ch == 85) {
  15.                 vowelsCounter++;
  16.                 sumOfVowels += ch;
  17.             }
  18.         }
  19.  
  20.         System.out.println(vowelsCounter);
  21.         System.out.println(sumOfVowels);
  22.     }
  23.  
  24. }
Advertisement
Add Comment
Please, Sign In to add comment
Advertisement