Advertisement
koksibg

Vowels_Sum

Oct 24th, 2016
3,549
0
Never
Not a member of Pastebin yet? Sign Up, it unlocks many cool features!
C# 0.95 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 Vowels_Sum
  10.     {
  11.         static void Main(string[] args)
  12.         {
  13.             int suma = 0;
  14.             int sume = 0;
  15.             int sumi = 0;
  16.             int sumo = 0;
  17.             int sumu = 0;
  18.             string s = Console.ReadLine().ToLower();
  19.             for (int i = 0; i <= s.Length - 1; i++)
  20.             {
  21.                 if (s[i] == 'a')
  22.                     suma++;
  23.                 else if (s[i] == 'e')
  24.                     sume += 2;
  25.                 else if (s[i] == 'i')
  26.                     sumi += 3;
  27.                 else if (s[i] == 'o')
  28.                     sumo += 4;
  29.                 else if (s[i] == 'u')
  30.                     sumu += 5;
  31.             }
  32.             int ResultSum = suma + sume + sumi + sumo + sumu;
  33.             Console.WriteLine(ResultSum);
  34.         }
  35.     }
  36. }
Advertisement
Add Comment
Please, Sign In to add comment
Advertisement