Quiz 1 Flashcards
Quiz for Sessions 1 to 3 (4 cards)
Product counter (3mins)
Multiple two inputs then get the length of their product.
Input:
100
100
Output:
Product: 1000
Length: 4
A
Divisible by 7 (2mins)
Print the numbers from 20 to 100 that is divisible by 7
Output:
7
14
21
…
98
A
Hourglass (6mins)
Ask the user for an input then print an hourglass where the top and bottom layers are composed of * corresponding to the user’s input. It should only allow an input of odd number, if the input is even, print an error message.
For the upper half layers, each layer should be two less than that of the layer above it.
For the lower half layers, each layer should be two more than that of the layer below it.
Input 1: 7
Output:
****
****
**
*
*
***
**
A
E-counter (6mins)
Print the numbers fifty to seventy and print how many times the letter e occurs in each number
Output:
Fifty: 0
Fifty-one
…
A