file.pdf

Name:

KCST ID:

CE-100 Introduction to Computer Systems

Quiz-3: August 18, 2020

Q1. Write a C++ program (no flowchart needed) that prints the numbers from 120

to 150, except 123, 132 and, 144. (5 marks)

Q2. What is the output of this program? (5 marks)

#include <iostream> using namespace std; int main() { for (int i=4; i>=1; i-=2) { for (int j=1; j<=2; j++) cout << i << "," << j << endl; } return 0; }

[Write your answer inside this box]

Q3. Write a C++ program (no flowchart needed) that reads the number of

items n in a bill. Then, it should read the n prices of those items, one by one,

and validate that each is in the range [0 – 1000]. Finally, it should print the

sum of the bill. (9 marks)