Question:
Pseudo Code: Output Position of First and Last Occurance - CAT
Modify the pseudo code to (a) Output position of the first occurrence of the word "CAT" (b) Output the position of the last occurrence of the word "CAT"
B010
Enter
Count = 0
POS = 0
While POS < 100
POS = POS + 1
IF BOOK(POS) = ‘CAT' THEN
COUNT = COUNT + 1
(ELSE)
ENDIF
ENDWHILE
IF COUNT = 0 THEN
Write ‘Not Found'
ELSE
Write ‘Found', COUNT, ‘times'
ENDIF
Return