Lab 01
Lab 01
Task 1:
Write a C++ program in which, read two integer array from user. Compare both array and display
either both arrays are same or not.
Example 1:
Input:
Array 1: 1 2 3 4 5
Array 2: 1 2 3 4 5
Output:
Arrays are same.
Example 2:
Input:
Array 1: 1 2 3 5 4
Array 2: 1 2 3 4 5
Output:
Arrays are not same.
Task 2:
Write a C++ program in which, read two integer array from user. Take intersection of both array
and display the resultant array.
Example:
Input:
Array 1: 1 2 3 4 5
Array 2: 6 7 3 4 10
Output:
Array: 3 4
Task 3:
Write a C++ program in which, given pattern should be printed. You can only use loop
variables.
Code Loop Variable
Output:
5 9 13 17 21
8 14 20 26 32
11 19 27 35 43
14 24 34 44 54
17 29 41 53 65
Task 4:
Write a C++ program in which, read one integer array from user and an integer number. Your
task is to delete the number from array if it exists.
Example 1:
Input:
Array: 1 2 3 4 5
Number: 3
Output:
Array: 1 2 4 5
Example 2:
Input:
Array: 1 2 3 4 5
Number: 6
Output:
The number does not exist
Task 5:
Write a C++ program in which, read two integer array from user and an integer number. Your
task is to search the number from array if it exists.
Example 1:
Input:
Array: 1 2 3 4 5
Number: 3
Output:
The number 3 exist at Index 2.