






Study with the several resources on Docsity
Earn points by helping other students or get them with a premium plan
Prepare for your exams
Study with the several resources on Docsity
Earn points to download
Earn points by helping other students or get them with a premium plan
Practical exercises on array operations, including inserting a new element at a given position, deleting an element, and finding the location of a given element. The exercises include the algorithm, flowchart, and code in c++ for each operation.
Typology: Exams
1 / 10
This page cannot be seen from the preview
Don't miss anything!







A[pos-1] =STOP element
A[i+1] = A[i]; i++
While i>=pos-
Set I = N-1Input elment and pos to insertDefine int N and Int A[N]
START
#include
#include
cout<<"Enter element to be delete : "; cin>>del; for(i=0; i<size; i++) { if(arr[i]==del) { for(int j=i; j<(size-1); j++) { arr[j]=arr[j+1]; } count++; break; } } if(count==0) { cout<<"Element not found..!!"; } else { cout<<"Element deleted successfully..!!\n"; cout<<"Now the new array is :\n"; for(i=0; i<(size-1); i++) { cout<<arr[i]<<" "; } } }
#include
break; } } if(i != size) { cout<<"KEY FOUND at index : "<<i; } else{ cout<<"KEY NOT FOUND in Array "; } return 0; }
#include <stdio.h> int main() { int LA[] = {2,4,6,8,9}; int i, n = 5;
printf("The array elements are:\n");
for(i = 0; i < n; i++) { printf("LA[%d] = %d \n", i, LA[i]); } }