IT 112 Problem Set
IT 112 Problem Set
LABORATORY WORKS
1st Semester SY 2023 – 2024
1. Write a program, a flowchart and an algorithm on how to find the product of two
numbers.
2. Write a program, a flowchart and an algorithm on how to find the remainder when
one number is divided by the other.
4. Write a program, a flowchart and an algorithm on how to find the area of the four
walls of a rectangular room. Given the formula: 𝐴 = 𝑤𝑙
5. Write a program, a flowchart and an algorithm on how to find the area and perimeter
of a circular plot. Given the Formula 𝐴 = 𝜋𝑟 2, where π = 3.1415.
6. Write a program, a flowchart and an algorithm on how to find the area and perimeter
of a square. Given the formula: 𝐴 = 𝑆 2
7. Write a program, a flowchart and an algorithm on how to find the cost of fencing a
rectangle at a given rate. Given that: Rate = 550 php.
8. Write a program, a flowchart and an algorithm on how to find the surface area of a
cone. Given the formula: 𝐴 = 𝜋𝑟(𝑟 + √ℎ2 + 𝑟 2 ).
9. Write a program, a flowchart and an algorithm on how to find the volume and surface
area of a sphere. Given the Formula: 𝐴 = 4𝜋𝑟 2
11. Write a program, a flowchart and an algorithm on how to obtain the volume of a
rectangular box. We know that the formula to determine the volume of a rectangular
box is Volume = Length × Breadth × Height. To determine the volume of a
rectangular box, we need to know the length, breadth, and height of the box. When
these values are multiplied together, the product represents the desired volume.
12. Write a program, a flowchart and an algorithm on how to obtain the daily wage of a
worker on the basis of the hours worked during the day. The daily wage depends on
two factors: the hours worked and hourly rate of pay. When the hours worked is
multiplied by the rate of pay, the product represents the wage of the worker. Assume
that the rate per day is 550 php.
13. Write a program, a flowchart and an algorithm on how to obtain the area of a triangle
on the basis of the base and height. Task Analysis. We know that the formula to find
out the area of a triangle is
1
𝐴𝑟𝑒𝑎 = 𝑥 𝑏𝑎𝑠𝑒 𝑥 ℎ𝑒𝑖𝑔ℎ𝑡
2
IT 112 Computer Programming 1 2
14. Write a program, a flowchart and an algorithm on how to find the simple interest on
a given amount at a given rate of interest. We know that if P is the principal, R is the
rate of interest, and T is the term in years, then the simple interest I is given by the
𝑃∗𝑅∗𝑇
formula 𝐼 = 100 . To determine the simple interest on a given amount, we need the
principal amount (P), the rate of interest (R), and the term in years (T). By putting
the values in the formula above, we get the desired simple interest.
15. If P amount of money is invested for N years at an annual rate of interest I, the money
grows to an amount T, where T is given by T = P (1 + I/100)N . Write a program, a
flowchart and an algorithm on how T is determined. The solution to this problem is
very simple, and it is similar to the preceding one. The inputs required are the values
for P, I, and N. The output T can then be obtained by putting the values in the formula.
Write a program, a flowchart and an algorithm.
17. Write a program, a flowchart and an algorithm on how to accept the item’s code, stock
on hand, and the rate per unit of stock in a department store and display the stock
value of the store. The inputs required to determine the stock value of the store are
the stock on hand and the rate per unit of stock, which are multiplied together to
determine the stock value. The item’s code is used as the identification data.
18. Determine whether a given number is even or odd. We know that a number is an even
number if it is completely divisible by 2. This means that if we perform integer
division upon the given number, then the remainder of the division will be zero. To
construct the flowchart, we accept a number as input, obtain the remainder of the
integer division by taking it as the divisor, and then check whether the remainder is
zero. If it is zero, then our conclusion will be that the number is an even number;
otherwise, it will be an odd number. Write a program, a flowchart and an algorithm.
19. Write a program, a flowchart and an algorithm to determine the net payable amount
on a sale. The net payable amount consists of the sale price plus sales tax. The sales
tax is decided as
a. 8% of the sale price for national items
b. 18% of the sale price for foreign items
We need to calculate the sales tax first by taking one of the two given rates. For this
purpose, we require two inputs: the sale price of the item under consideration and the
origin of the item. Let us assume that we provide “N” or “F” as the input to indicate
“national” or “foreign,” respectively.
20. The following rules are used to calculate the bonus for the employees of an
organization.
(i) If the pay is more than $3,000, the bonus amount is fixed, and it is equal to $300.
IT 112 Computer Programming 1 3
(ii) If the pay is more than $1,600, but less than or equal to $3,000, the bonus will be
10% of the pay subject to a maximum of $240.
(iii) If the pay is less than or equal to $1,600, the bonus is 15% of pay, subject to a
minimum of $100.
The input required here is the pay amount that an employee gets. On the basis of
the pay, we can determine the bonus amount. The “subject to maximum” or the
“subject to minimum” clause implies that the calculated amount should be
compared with the maximum or minimum limit. If it is more than the maximum
limit or less than the minimum limit, then the maximum limit or the minimum limit
will be treated as the legitimate value. Write a program, a flowchart and an
algorithm.
21. Write a program, a flowchart and an algorithm to determine the grade of the steel on
the basis of the values of three characteristics, namely, the Rockwell hardness, carbon
content, and tensile strength. The values of these three features are the input.
22. A bookseller offers two rates of commissions. If the price of a book is below $100, the
rate of commission is 12% of the price, otherwise, it is 18% of the price. Develop a
procedure to determine the discount and the net price of a book. The outputs required
are the discount and net price of a book. The only input required for this purpose is
price of the book. The rates of the discount are constants (fixed). These rates can be
used to develop formulas to calculate the discounts in the two different cases. The
calculated discount can then be subtracted from the price of the book to obtain the
net price. Write a program, a flowchart and an algorithm.
Prepared by:
1. Write a program, a flowchart and an algorithm on how to find the product of two
numbers.
ALGORITHM
Input : input two number: (num1, num2)
Process : product = num1 * num2
Output : display product
FLOWCHART
start
compute product
product = num1 * num2
display product
end
PROGRAM CODE
num1 = int(input("Enter first number: "))
num2 = int(input("Enter second number: "))
Output
Enter first number: 2
Enter second number: 3
The product of 2 * 3 is: 6