Enter n no. of element and delete value from desire position
Answer / ruchi
#include<stdio.h>
#include<conio.h>
int main()
{
int n,pos,i,a[20];
printf("\nEnter how many elements are there in an array ");
scanf("%d",&n);
printf("\nEntert the elements ");
for(i=0;i<n;i++)
{
scanf("%d",&a[i]);
}
printf("\nEnter the position from where u want to delete
an item ");
scanf("%d",&pos);
pos=pos-1;
for(i=0;i<n;i++)
{
if((i==pos)&&(i!=n-1))
{
i=i+1;
}
if((i==pos)&&(i==n-1))
break;
printf("%d\n",a[i]);
}
getch();
}
| Is This Answer Correct ? | 2 Yes | 0 No |
Difference between a homogeneous and a heterogeneous container
Is linux written in c or c++?
Are strings mutable in c++?
Copy Linked List using recursive function?
Which bit wise operator is suitable for turning off a particular bit in a number?
Can you Mention some Application of C/C++?
What are pointers used for c++?
What is the size of pointer ? Also size of pointer in 64 bit pointer
Are iterators pointers?
What is the use of static functions?
What is flush c++?
Explain linear search.