Advertisement
Guest User

fdasfa

a guest
Feb 23rd, 2017
77
0
Never
Not a member of Pastebin yet? Sign Up, it unlocks many cool features!
text 0.95 KB | None | 0 0
  1. %Henry So
  2. %2017 Feb 23
  3. %4-5 Q5
  4.  
  5. var vowel : string
  6. var countA : int := 0
  7. var countE : int := 0
  8. var countI : int := 0
  9. var countO : int := 0
  10. var countU : int := 0
  11.  
  12. put "Enter a string :)"
  13. get vowel : *
  14.  
  15. for x : 1 .. length (vowel)
  16. if vowel (x) = "a" or vowel (x) = "A" then
  17. countA := countA + 1
  18. elsif vowel (x) = "e" or vowel (x) = "E" then
  19. countE := countE + 1
  20. elsif vowel (x) = "i" or vowel (x) = "I" then
  21. countI := countI + 1
  22. elsif vowel (x) = "o" or vowel (x) = "O" then
  23. countO := countO + 1
  24. elsif vowel (x) = "u" or vowel (x) = "U" then
  25. countU := countU + 1
  26. end if
  27. end for
  28.  
  29. put "Vowel" : 10 ..
  30. put "# of occurrences" : 10
  31. put " --------------------------------------------------------------"
  32. put "A" : 10 ..
  33. put countA
  34. put "E" : 10 ..
  35. put countE
  36. put "I" : 10 ..
  37. put countI
  38. put "O" : 10 ..
  39. put countO
  40. put "U" : 10 ..
  41. put countU
Advertisement
Add Comment
Please, Sign In to add comment
Advertisement