0% found this document useful (0 votes)
19 views

CBS1002 Lab 18

Uploaded by

mastertechguide
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)
19 views

CBS1002 Lab 18

Uploaded by

mastertechguide
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/ 2

CBS1002 Lab 18-12-2024

Instructions:
➢ Do the following exercises using C++ and upload the program in Moodle
without fail.
➢ Refer page 2 to prepare the report.
➢ Save your file with your register number as regno.pdf [ Ex: 24BBS0001.pdf]

C++ Exercises
1. Write a program to print "Hello, World!" on the screen.

2. Create a program that performs addition, subtraction, multiplication, and

division using user input.

3. Write a program to check whether a given number is odd or even.

4. Implement a program to determine if a number is prime or not.

5. Generate the Fibonacci sequence up to a specified number of terms.

6. Write a program to find the largest and smallest numbers in an array.

7. Write a program to swap two numbers using:

1. A temporary variable.

2. Without using a temporary variable.

8. Create a program that checks if a given year is a leap year or not.

9. Write a program to calculate the sum of the digits of a given number.

10. Write a program to reverse the digits of a number.

Example: Input = 12345 → Output = 54321.

11. Implement a program to check if a number is a palindrome.

Example: 121 is a palindrome; 123 is not.

12. Write a program to compute the factorial of a number using a loop.

13. Create a program to display the multiplication table for a given number.

14. Write a program to find the largest of three numbers entered by the user.

15. Write a program to count the number of digits in a given number.


Q.No 1
Aim:
// Question

Program:
// copy and paste the program

Output:
// Screenshot of the output

Q.No 2
Aim:
// Question

Program:
// copy and paste the program

Output:
// Screenshot of the output

.
.
.
.

.
.
.

You might also like