0% found this document useful (0 votes)
55 views5 pages

Itc111 Lab Midterm

The document contains instructions for a computer programming midterm exam. It includes 3 incomplete programs to be completed by the student. The first program asks the user to input a number of asterisks and prints a decreasing number of asterisks in rows until one is reached, displaying the total. The second prints the multiplication table of a user-entered number. The third uses a while loop to calculate the product of odd input numbers and sum of even numbers. It also asks the student to write while and for loops for different cases and a program to input and output a name and age.
Copyright
© © All Rights Reserved
We take content rights seriously. If you suspect this is your content, claim it here.
Available Formats
Download as PDF, TXT or read online on Scribd
0% found this document useful (0 votes)
55 views5 pages

Itc111 Lab Midterm

The document contains instructions for a computer programming midterm exam. It includes 3 incomplete programs to be completed by the student. The first program asks the user to input a number of asterisks and prints a decreasing number of asterisks in rows until one is reached, displaying the total. The second prints the multiplication table of a user-entered number. The third uses a while loop to calculate the product of odd input numbers and sum of even numbers. It also asks the student to write while and for loops for different cases and a program to input and output a name and age.
Copyright
© © All Rights Reserved
We take content rights seriously. If you suspect this is your content, claim it here.
Available Formats
Download as PDF, TXT or read online on Scribd
You are on page 1/ 5

Republic of the Philippines

RIZAL TECHNOLOGICAL
UNIVERSITY
Cities of Mandaluyong and
Pasig

COLLEGE OF ENGINEERING, ARCHITECHTURE AND TECHNOLOGY


INFORMATION TECHNOLOGY
DEPARTMENT
.

ITC11L
(COMPUTER PROGRAMMING
1) LABORATORY_MIDTERM
Student Name /
Group Name:

Section:

Professor:

/mbf2021 INFORMATION TECHNOLOGY DEPARTMENT


Republic of the Philippines
RIZAL TECHNOLOGICAL
UNIVERSITY
Cities of Mandaluyong and
Pasig

COLLEGE OF ENGINEERING, ARCHITECHTURE AND TECHNOLOGY

A. Directions: Complete the programs below that satisfy the given problem specification and output. Paste
your completed source code in the Code portion then highlight the statement(s) that you filled in the
incomplete program with chosen color. Work independently. Please observe INTEGRITY & HONESTY
ALL THE TIME. (50 points)

Program No. 1

The program should ask the user the initial number of asterisks it will display in the first row after the input. The
program then should display a decreasing number of asterisks in the succeeding row until it reaches a single
asterisk. The program should also display the total number of asterisks printed on screen.
Incomplete Program Sample Output
#include<iostream>

using namespace std;

int main() {

int x, count, y, total = 0;

cout << "Enter number of stars :

"; cin >> count;

for (x = count; _____________; x--)

{ total = _____________

for (_____________; y > 0; y--


)

cout << "*";

cout << "\n";

cout << "Wow! You’ve got " <<


total << " stars in all!!!";

return 0;

Code

/mbf2021 INFORMATION TECHNOLOGY DEPARTMENT


Republic of the Philippines
RIZAL TECHNOLOGICAL
UNIVERSITY
Cities of Mandaluyong and
Pasig

COLLEGE OF ENGINEERING, ARCHITECHTURE AND TECHNOLOGY

Program No. 2
The program should display the Multiplication Table of a number entered by the user.
Incomplete Program Sample Output
#include<iostream>

using namespace std;

int main() {

int x, no;

cout << "Enter number:";

cin >> no;

cout << "Multiplication Table of "


<< no << endl;

x = 1;

while (_________) {

cout << no << " x " << x << "


=" << _________ << "\n";

_________

return 0;

Code:

/mbf2021 INFORMATION TECHNOLOGY DEPARTMENT


Republic of the Philippines
RIZAL TECHNOLOGICAL
UNIVERSITY
Cities of Mandaluyong and
Pasig

COLLEGE OF ENGINEERING, ARCHITECHTURE AND TECHNOLOGY

Program 3: Create a program that will allow the user to enter five numbers and display the product of “odd
numbers”; and displays the sum of even inputted numbers using WHILE LOOP. Sample output is shown below.
***use WHILE loop and If-then-else
4. Create a simple program that will display the sample output below.

B. Write a while and for statements for each of the following cases: (5pts each)

a. Use a counter named i, initialize variable i to 10 and the value of i is decremented by 1. (while) b.

Use a counter named x and with initial value of 1, a final value of 20, and an increment of 1. (for)

c. Use a counter named count that has an initial value of 1, a final value of 100, and an increment of 5.
(for).

/mbf2021 INFORMATION TECHNOLOGY DEPARTMENT


Republic of the Philippines
RIZAL TECHNOLOGICAL
UNIVERSITY
Cities of Mandaluyong and
Pasig

COLLEGE OF ENGINEERING, ARCHITECHTURE AND TECHNOLOGY

C. Write, compile, and run a C++ program that allows the user to enter his/her name & age. You can modify
the “cout”.

SAMPLE OUTPUT:
***END OF EXAM***

/mbf2021 INFORMATION TECHNOLOGY DEPARTMENT

You might also like