DSA Practical Exam pdf - 17 jan 2024
DSA PRACTICAL PDF : Practical 1 Aim: Write a C++ program to 1.1) Traverse the elements in array Program: - #include<iostream> using namespace std; int main(){ int arr[100],n,a; cout <<"Enter the size of array: "; cin>>n; cout <<"Enter the element of array: "; for(int i =0; i<n; i++){ cin >> a; arr[i] = a; } cout <<"the element of array : "<< endl; for(int j = 0; j< n; j++){ cout << arr[j]<< endl; } return 0; } Output: 1.2) insert the elements in array Program: #include<iostream> using namespace std; int main() { int arr[100], n, a, item, pos; cout << "Enter the size of array: "; cin >> n; cout << "Enter the elements of array: "; for(int i = 0; i < n; i++) { cin >> a; arr[i] = a; } cout << "The elements of array: " << endl; for(int j = 0; j < n; j++) { cout << arr[j] << endl; } cout << ...