Professional Documents
Culture Documents
Laboratory Activity No.2 Programming
Laboratory Activity No.2 Programming
1. Write a program that has 2 variables: weeks and days declared as integer type. Initialize weeks to 18. Then, have your program
calculate the number of days and output a statement giving this information: “There are 126 days in 18 weeks.”
Note: The 1st blank in days is the number of days in 18 weeks. 18 would appear on the 2nd blank. Do not just simply write 18 but you
must have to call or invoke the variable that holds for the number of weeks.
a. Type your C++ code in the C++ IDE and execute your
program.
b. What is the value of the kilometers in step 4? 160.9 km
c. Support your answer by taking a screenshot of the
output of your program.
3. (Convert feet into meters). Write a program that declares and initializes a variable in feet, converts it to meters, and displays the result.
One foot is 0.3048 meter. (You can declare any value for the feet, Example if you declare feet as equal to 15).
Expected Output:
15 feet is 4.572 meters
4. (Find the number of years). Write a program that declares and initializes a value in minutes (example 1 million), and displays the
number of years and days for the minutes. For simplicity, assume a year has 365 days.
Expected Output:
CBE4 – Computer Fundamentals and Programming Unit 3: Variables and Data Types Instructor: J. O. Balolot 1