C Program to delete an element from specified location in array

C Program to Delete an element from specified location in Array

This page has a C Program to delete an element from the specified location in Array. It is clear that, this C program will delete an element from the specified location from Array. For example: If we have entered 6 elements in an array as  35   78    64    43    12   46  and if we want to delete an element (43) from the array,  then the program should ask the location (3) of the element (43) to be deleted from the array; Then the program will have to accept the the location (4) and then the element will be deleted from the array as  35   78   64   12   46The below given C program will delete an element from Array.  Kindly check out the program to delete an element from the Array. The questions to delete an element from Array can be asked as,

1). C Program to delete an element from the specified location from Array
2). C program to delete an element from an array
3). C Program to delete the specified element from an Array
4). C program to delete an element from specified location in array

Program to Insert an element in Array


   #include<stdio.h>
   int main(){
                 int array1[30];
                 int i, loc, n1, n2;
                 printf("\nEnter no of elements to array : ");
                 scanf("%d", &n1);
                 printf("\n\n Enter the Array elements one by one \n");
                 for (i = 1; i<=n1; i++) {
                 scanf("%d", &array1[i]);
                 }
                 printf("\n Enter a location to be deleted :");
                 scanf("%d", &loc);
                 for (i = n1; i>loc; i--)
                 array1[i-1]=array1[i];
                 printf("\n The Array elements are : \n");
                 for (i = 1; i<=n1-1; i++)
                 printf("\n %d", array1[i]);
    return(0);
    }


Sample Output:                  


Enter no of elements to array : 6
Enter the Array elements one by one
57 34 67 23 56 38
Enter a location to be deleted :3
The Array elements are :
57
34
23
56
38


Related Popular Posts:


*  Write a c program to check whether a given number is prime number or not?

 

*  Write a C program to find the prime numbers between 1 and 100

 

*  Write a C program to display the prime numbers between a range ?

 

*  Write a C program to find the prime numbers between a range using while loop?

 

*  Write a C program to find the sum of prime numbers between a range 

Other Related C Programs :


* C Program to find whether the given number is Odd or Even

* C Program to find the Sum of Odd Digits

* C Program to find the Sum of Even Digits

* C Program to find the Sum of Even and Odd Digits,

* C Program to Display Odd digits

* C Program to Display even digits

* C Program to Display Odd Numbers,

* C Program to Display Even Numbers,

* C Program to Check whether the given number is Armstrong number

* C Program to display the Armstrong numbers in Range

* C Program to display the Armstrong numbers between 1 and 1000

* C Program to check perfect number, perfect numbers in range

* C Program to Check Prime number, Prime numbers between 1 and 100

* C Program to display the Prime numbers in a Range

* C Program to display the Sum of Prime numbers

* C Program to Check Strong number

* C Program to display the Strong number in Range

* C Program to Check whether the given number is polindrome number or not

* C Program to Check polindrome number using for loop

* C Program to Check polindrome number using Recursion

* C Program to  check whether the given string is polindrome or not

* C Program to find the Roots of Quadratic equation

* C Program to display Fibonacci Series

* C Program to display the Fibonacci Series using an array

* C Program to display the Fibonacci Series using while loop

* C Program to find the Sum of Fibonacci Series, Factorial of Number

* C Program to find the Factorial without using Recursion

* C Program to find the Factorial using Pointers

* C Program to find the Factorial using Function

Bookmark and Share