Lab-4 Journal-04-21032023-112323am
Lab-4 Journal-04-21032023-112323am
Objective(s):
Upon completion of this lab session, students will be able to:
• Understanding of IF-ELSE, IF-ELSE-IF, For loop
Tasks
Task 1
Write a program that asks the user to enter two numbers. The program should use the
conditional operator to determine which number is the smaller and which is the larger.
Task 2
Write a C++ Program that read an integer input in between (1 to 12) and store it
month_of_year. Print the corresponding month of year. Use if else statement.
Example: Input is 4… Print “April”
Task 3
Write a C++ Menu driven program that allows a user to enter 2 numbers and then choose
between findings the sum, subtraction, division, multiplication or average. Use if else
statement to determine what action to take.
Task 4
(Body Mass Index Calculator)
The formulas for calculating, BMI is,
BMI = weight In Pounds x 703 / (height Inches x height Inches )
Create a BMI calculator application that reads the user's weight in pounds and height in
inches (or, if you prefer, the user's weight in kilograms and height in meters), then
calculates and displays the user's body mass index. The user can evaluate his/her BMI:
BMI Values
Underweight Less 18.5
Normal Between 18.5 and 24.9
Overweight Between 25 and 29.9
Obese 30 or greater
%
Task 5
Write a program in C++ that prompts the user to enter their marks and assigns a grade based
on the following chart of grade marks distribution?
A 85-100
A- 80-84
B+ 75-79
B 71-74
B- 68-70
C+ 64-67
C 60-63
C- 57-59
D+ 57-56
D 50-53
F 0-49
Task 6
Write a program to find the factorial of a given number.
Test Data:
Input a number: 5
Expected Output:
120
Max Obtained
Task Comments (if any)
Marks Marks
1. 05
2. 05
3. 05
4. 05
Total 20 Signature
Note: Attempt all tasks and get them checked by your Lab Instructor.
Page 2 of 2