Advertisement
Guest User

04. Vowels Sum

a guest
Nov 14th, 2019
115
0
Never
Not a member of Pastebin yet? Sign Up, it unlocks many cool features!
text 1.11 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 _04.Vowels_Sum
  8. {
  9. class Program
  10. {
  11. static void Main(string[] args)
  12. {
  13. string letter = Console.ReadLine();
  14.  
  15. int finalResult = 0;
  16.  
  17. for (int i = 0; i < letter.Length; i++)
  18. {
  19. char eachLetter = letter[i];
  20.  
  21. if (eachLetter == 'a')
  22. {
  23. finalResult += 1;
  24. }
  25. else if (eachLetter == 'e')
  26. {
  27. finalResult += 2;
  28. }
  29. else if (eachLetter == 'i')
  30. {
  31. finalResult += 3;
  32. }
  33. else if (eachLetter =='o')
  34. {
  35. finalResult += 4;
  36. }
  37. else if (eachLetter == 'u')
  38. {
  39. finalResult += 5;
  40. }
  41. }
  42.  
  43. Console.WriteLine(finalResult);
  44. }
  45. }
  46. }
Advertisement
Add Comment
Please, Sign In to add comment
Advertisement