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
Which should be more useful: the protected and public virtuals?
What is a storage class?
Explain about Virtual Function in C++?
Explain mutable storage class specifier.
What is the basic structure of a c++ program?
Explain data encapsulation?
What does n mean in c++?
What are multiple inheritances (virtual inheritance)?
Can we use struct in c++?
What are pointers, when declared, intialized to a) NULL b) Newly allocated memory c) Nothing. Its random
What do the keywords volatile and mean mutable?
daily Routine of father
How do you print a string on the printer?
What is a wchar_t in c++?
Why pointer is used in c++?