Lab Journal 04 CP 01032024 095149am
Lab Journal 04 CP 01032024 095149am
Objective(s):
Upon completion of this lab session, students will be able to:
• Understand the Data types and variables
• Understand the of Operators and
Tasks
Task 01:
1. Write a program that gets 2 integers input from the user and stores them in variables. Do
the five basic Arithmetic Operations (+, - , *, /, %) of the two numbers. Print the results of
operations as below.
%
2. Write a program that prompt user to input the course name, obtained marks, and total
marks. Calculate the percentage using the below formula
marks_percentage = ( marks_obtained / total )* 100
and display the results as follows.
Task 02:
1. Write a program that converts Celsius temperatures to Fahrenheit temperatures. The
formula is:
F= (9/5)*C+32
Page 2 of 5
%
2. Write a program that prompts the user to enter the weight of a person in kilograms and
outputs the equivalent weight in pounds. Output both the weights rounded to two decimal
places. (Note that 1 kilogram is equal to 2.2pounds.) Format your output with two decimal
places.
Page 3 of 5
%
Task 03:
Hypotenuse refers to the side opposite the right angle in a right-angled triangle (as shown in
the diagram below).
The area of this right-angled triangle can also be calculated using the following formula:
a = (½) * x * y
Note that:
h= hypotenuse
x= adjacent
y= opposite
Write a C++ program that prompts the user to enter the value of X and Y. You have to
calculate the value of Area (a)
Page 4 of 5
%
Max Obtained
Task Comments (if any)
Marks Marks
1. 4
2. 4
3. 2
Total 10 Signature
Note: Attempt all tasks and get them checked by your Lab Instructor.
Page 5 of 5