Krasimir_Slavov

Untitled

Oct 14th, 2018
114
0
Never
Not a member of Pastebin yet? Sign Up, it unlocks many cool features!
text 0.80 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 For_Vowels_Sum
  8. {
  9. class Program
  10. {
  11. static void Main(string[] args)
  12. {
  13. string text = Console.ReadLine();
  14.  
  15. int sum = 0;
  16. for (int i = 0; i < text.Length; i++)
  17. {
  18. char letter = text[i];
  19. switch (letter)
  20. {
  21. case 'a': sum += 1; break;
  22. case 'e': sum += 2; break;
  23. case 'i': sum += 3; break;
  24. case 'o': sum += 4; break;
  25. case 'u': sum += 5; break;
  26.  
  27. }
  28. }
  29. Console.WriteLine($"Sum: {sum}");
  30.  
  31.  
  32.  
  33.  
  34.  
  35. }
  36. }
  37. }
Advertisement
Add Comment
Please, Sign In to add comment