Advertisement
Martin86

Untitled

Apr 5th, 2020
197
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 VowelSum
  4. {
  5.     class Program
  6.     {
  7.         static void Main(string[] args)
  8.         {
  9.             string text = Console.ReadLine();
  10.             int len =text.Length;
  11.             double sum = 0;
  12.             for (int i = 0; i < len; i++)
  13.             {
  14.                 char letter = text[i];
  15.                 if(letter=='a')
  16.                 {
  17.                     sum += 1;
  18.                 }
  19.                 else if(letter=='e')
  20.                 {
  21.                     sum += 2;
  22.                 }
  23.                 else if(letter=='i')
  24.                 {
  25.                     sum += 3;
  26.                 }
  27.                 else if(letter =='o')
  28.                 {
  29.                     sum += 4;
  30.                 }
  31.                 else if(letter== 'u')
  32.                 {
  33.                     sum += 5;
  34.                 }
  35.             }
  36.                
  37.                
  38.           Console.WriteLine(sum);  
  39.         }
  40.     }
  41. }
Advertisement
Add Comment
Please, Sign In to add comment
Advertisement