Enter n no. of element and delete value from desire position
Answer Posted / 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 |
Post New Answer View All Answers
What is #include c++?
Keyword mean in declaration?
How many namespaces are there in c++?
Can we delete this pointer in c++?
How does list r; differs from list r();?
What are shallow and deep copy?
How do you remove an element from a set in c++?
Is it possible to provide default values while overloading a binary operator?
Why struct is used in c++?
What is the difference between set and map in c++?
What is a responder chain?
What causes a runtime error c++?
What are static and dynamic type checking?
What are the rules about using an underscore in a c++ identifier?
What are c++ redistributables?