L10-Ch+4 loops+Sample+Questions
L10-Ch+4 loops+Sample+Questions
L10-Ch+4 loops+Sample+Questions
3. Write programs that read a sequence of integer inputs and print [P4.2, Page 178]
a. The smallest and largest of the inputs.
b. The number of even and odd inputs.
c. Cumulative totals. For example, if the input is 1 7 2 9, the program should print 1
8 10 19.
d. All adjacent duplicates. For example, if the input is 1 3 3 4 5 5 6 6 2, the program
should print 3 5 6.
4. Write programs that read a line of input as a string and print [P4.3, Page 178]
a. Only the uppercase letters in the string.
b. Every second letter of the string.
c. The string, with all vowels replaced by an underscore.
d. The number of vowels in the string.
e. The positions of all vowels in the string.