Yachkov

vowel sum

Jan 31st, 2021
66
0
Never
Not a member of Pastebin yet? Sign Up, it unlocks many cool features!
C# 1.20 KB | None | 0 0
  1. using System;
  2. using System.ComponentModel;
  3. using System.ComponentModel.DataAnnotations;
  4. using System.ComponentModel.Design;
  5. using System.Globalization;
  6. using System.Net.Http.Headers;
  7. using System.Reflection;
  8. using System.Runtime.ConstrainedExecution;
  9. using System.Security.Cryptography;
  10. using Microsoft.VisualBasic.CompilerServices;
  11.  
  12. namespace SomeExcercises
  13. {
  14.     class Program
  15.     {
  16.         static void Main(string[] args)
  17.         {
  18.             string text = Console.ReadLine();
  19.             int sum = 0;
  20.  
  21.             for (int i = 0; i < text.Length; i++)
  22.             {
  23.                 if (text[i] == 'a')
  24.                 {
  25.                     sum += 1;
  26.                 }
  27.                 else if (text[i] == 'e')
  28.                 {
  29.                     sum += 2;
  30.                 }
  31.                 else if (text[i] == 'i')
  32.                 {
  33.                     sum += 3;
  34.                 }
  35.                 else if (text[i] == 'o')
  36.                 {
  37.                     sum += 4;
  38.                 }
  39.                 else if (text[i] == 'u')
  40.                 {
  41.                     sum += 5;
  42.                 }
  43.             }
  44.  
  45.             Console.WriteLine(sum);
  46.         }
  47.     }
  48. }
  49.  
  50.  
  51.  
  52.  
Advertisement
Add Comment
Please, Sign In to add comment