Write a program to print an array after deleting specific element from it.
- #include <stdio.h>
- void main()
- {
- int arr[100], position, i, n;
- printf("Enter number of elements in array : ");
- scanf("%d", &n);
- printf("Enter %d elements : ", n);
- for ( i=0 ; i < n ; i++ )
- scanf("%d", &arr[i]);
- printf("Enter the position to delete element : ");
- scanf("%d", &position);
- if ( position >= n+1 )
- printf("Deletion not possible.\n");
- else {
- for ( i = position-1 ; i < n-1 ; i++ )
- arr[i] = arr[i+1];
- printf("After deleting specific element is : ");
- for(i = 0 ; i < n - 1 ; i++ )
- printf("%d\n", arr[i]);
- }
- }
একটি মন্তব্য পোস্ট করুন