grach

VowelsSum

Jul 14th, 2017
88
0
Never
Not a member of Pastebin yet? Sign Up, it unlocks many cool features!
C# 0.75 KB | None | 0 0
  1. using System;
  2. using System.Collections.Generic;
  3. using System.Linq;
  4. using System.Text;
  5. using System.Threading.Tasks;
  6.  
  7. namespace Vowels_Sum
  8. {
  9.     class Program
  10.     {
  11.         static void Main(string[] args)
  12.         {
  13.             var word = Console.ReadLine();
  14.             var sum = 0;
  15.             for (int i = 0; i < word.Length; i++)
  16.             {
  17.                 switch (word[i])
  18.                 {
  19.                     case 'a': sum += 1; break;
  20.                     case 'e': sum += 2; break;
  21.                     case 'i': sum += 3; break;
  22.                     case 'o': sum += 4; break;
  23.                     case 'u': sum += 5; break;
  24.                 }
  25.                     }
  26.  
  27.             Console.WriteLine(sum);          
  28.  
  29.         }
  30.     }
  31. }
Advertisement
Add Comment
Please, Sign In to add comment