NedyalkoKikov

VowelSum

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