Pre Test Computer Science: Looping & Branching

BY IN IB Computer Science Comments Off on Pre Test Computer Science: Looping & Branching

PRE TEST COMPUTER SCIENCE
TOPIC: ALGORITHM & PROGRAMMING
SUB TOPIC: LOOPING & BRANCHING

Instruction:
In this Pre Test, you MAY use a computer to test and debug your program.
Please submit your program via e-mail: contact@wahyukurniawan.info

1. Construct a program that can have an output like this:
1
2
3
4
5

2. Construct a program that have an output like this:
2
4
6
8
6
4
2

3. Construct a program that have an input number 1 until 5, and give an output like this:
Input: 2
Output:
1
2
Input: 3
Output:
1
2
3

4. Construct a program that have an input number 0 or 1, and give an output like this:
Input: 0
Output: You entered 0
Input: 1
Output: You entered 1
plus, program can display an error message if user input any values other than 0 or 1
Input: 5
Output: Please enter only 0 and 1




Comments are closed.