Advertisement
Guest User

04. Vowels Sum

a guest
Dec 15th, 2019
75
0
Never
Not a member of Pastebin yet? Sign Up, it unlocks many cool features!
C# 0.93 KB | None | 0 0
  1. using System;
  2.  
  3. namespace VowelsSum
  4. {
  5.     class Program
  6.     {
  7.         static void Main(string[] args)
  8.         {
  9.             string input = Console.ReadLine();
  10.             int sum = 0;
  11.  
  12.             for (int i = 0; i < input.Length; i++)
  13.             {
  14.                 char currentLetter = input[i];
  15.                 switch (currentLetter)
  16.                 {
  17.                     case 'a':
  18.                         sum += 1;
  19.                         break;
  20.                     case 'e':
  21.                         sum += 2;
  22.                         break;
  23.                     case 'i':
  24.                         sum += 3;
  25.                         break;
  26.                     case 'o':
  27.                         sum += 4;
  28.                         break;
  29.                     case 'u':
  30.                         sum += 5;
  31.                         break;
  32.                 }
  33.             }
  34.  
  35.             Console.WriteLine(sum);
  36.         }
  37.     }
  38. }
Advertisement
Add Comment
Please, Sign In to add comment
Advertisement