Advertisement
Not a member of Pastebin yet?
Sign Up,
it unlocks many cool features!
- %Henry So
- %2017 Feb 23
- %4-5 Q5
- var vowel : string
- var countA : int := 0
- var countE : int := 0
- var countI : int := 0
- var countO : int := 0
- var countU : int := 0
- put "Enter a string :)"
- get vowel : *
- for x : 1 .. length (vowel)
- if vowel (x) = "a" or vowel (x) = "A" then
- countA := countA + 1
- elsif vowel (x) = "e" or vowel (x) = "E" then
- countE := countE + 1
- elsif vowel (x) = "i" or vowel (x) = "I" then
- countI := countI + 1
- elsif vowel (x) = "o" or vowel (x) = "O" then
- countO := countO + 1
- elsif vowel (x) = "u" or vowel (x) = "U" then
- countU := countU + 1
- end if
- end for
- put "Vowel" : 10 ..
- put "# of occurrences" : 10
- put " --------------------------------------------------------------"
- put "A" : 10 ..
- put countA
- put "E" : 10 ..
- put countE
- put "I" : 10 ..
- put countI
- put "O" : 10 ..
- put countO
- put "U" : 10 ..
- put countU
Advertisement
Add Comment
Please, Sign In to add comment
Advertisement