1 .
program Arrays
2 #include <stdio.h>
• #include <conio.h>
• void main()
• {
• int arr[50], n, pos, item,i;
• // Input the size of the array
• printf("Enter the size of the array: ");
• scanf("%d", &n);
• // Input the elements of the array
• printf("Enter the elements of the array:");
• for ( i = 0; i < n; i++)
• {
• scanf("%d", &arr[i]);
• }
• // Input the position and value of the new element to be inserted
• printf("Enter the position and value of the new element to be inserted: ");
• scanf("%d%d", &pos, &item);
• // Shift the elements after the insertion position to the right
• for (i = n - 1; i >= pos-1; i--)
• {
• arr[i+1] = arr[i];
• }
• // Insert the new element at the desired position
• arr[pos-1] = item;
• // Increment the size of the array
• n++;
• // Print the updated array
• printf("The updated array is:");
• for (i = 0; i < n; i++)
• {
• printf("%d", arr[i]);
• }
• getch();
2. program
• #include <stdio.h>
• #include <conio.h>
• void main()
• {
• int array[100], position, i, n;
• printf("Enter the number of elements in array");
• scanf("%d", &n);
• printf("Enter %d elements", n);
• for (i = 0; i < n; i++)
• {
• scanf("%d", &array[i]);
• }
• printf("Enter the location where you wish to delete element");
• scanf("%d", &position);
• if (position >= n+1)
• {
• printf("Deletion not possible.");
• }
• else
• {
• for (i = position-1; i < n-1; i++)
• {
• array[i] = array[i+1]; //shifting
• }
• printf("Final array is");
• for (i = 0; i < n-1; i++)
• {
• printf("%d", array[i]);
• }
• }
• getch();
3. Program
• printf("Final array is");
• for (i = 0; i < n-1; i++)
• {
• printf("%d", array[i]);
• }
• }
• getch();
• // searching
• printf("\nElement to be searched:");
• scanf(" %d", &item);
• while( j < ub)
• {
• if( data[j] == item )
• { break;
• }
• j = j + 1;
• }
• printf("\nElement %d is found at %d position", item, j+1);
• getch();
}