____  ___    _  _     _   _ _____     _______
 / ___|/ _ \  | || |   | | | |_ _\ \   / / ____|
| |  _| | | | | || |_  | |_| || | \ \ / /|  _|
| |_| | |_| | |__   _| |  _  || |  \ V / | |___
 \____|\___/     |_|   |_| |_|___|  \_/  |_____|

 --- A GOPHER-LIKE INTERFACE FOR HIVE BLOCKCHAIN ---

C program to delete an element in an array

BY: @shivangi | CREATED: March 12, 2018, 1:33 a.m. | VOTES: 1 | PAYOUT: $0.00 | [ VOTE ]

Deleting an element refers to the deletion of a single element at particular location in array. We will try to delete this element using c program.

             

Program:

include<stdio.h>

int main()

{

    int i,p,n,a[20],c[20];

    printf("Enter the value of n:\n");

    scanf("%d",&n);

    printf("Enter the value in 1 :\n");

    for(i=0;i<=n;i++)

    {

        scanf("%d",&a[i]);

    }

    printf("Enter the value of p:\n");

    scanf("%d",&p);

    for(i=p;i<=n;i++)

    {

        a[i]=a[i+1];

    }

     for(i=0;i<=n-1;i++)

    { printf("%d",a[i]);

}

}

TAGS: [ #programming ] [ #technology ] [ #education ] [ #blog ] [ #include ]

Replies

NO REPLIES FOUND.

[ BACK TO TRENDING ] [ BACK TO MENU ]
CMD>