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 |
Can we declare a base-class destructor as virtual?
Why was c++ created?
How is an Abstract Base Class(ABC) related to an "Abstract Data Type" (ADT)
If dog is a friend of boy, is boy a friend of dog?
What is "map" in STL?
Can inline functions have a recursion? Give the reason?
Will the inline function be compiled as the inline function always? Justify.
How would you use the functions sin(), pow(), sqrt()?
What are the benefits of oop in c++?
What happens when you make call 'delete this;'?
Is the declaration of a class its interface or its implementation?
What do you mean by “this” pointer?