Advertisement
tsvetelinapasheva

TsvetelinaPasheva/ForLoopLab/06.VowelsSum

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