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 |
What do you mean by “this” pointer?
What is the topic of the C++ FAQ list?
What are the various access specifiers in c++?
What issue do auto_ptr objects address?
What is function overloading in C++?
Is vector a class in c++?
To which numbering system can the binary number 1101100100111100 be easily converted to?
How Virtual functions call up is maintained?
Why Pointers are not used in C++?
Which is not an ANSII C++ function a) sin() b) tmpnam() c) kbhit()
Is map sorted c++?
What data structure is fastest, on average, for retrieving data: a) Binary Tree b) Hash Table c) Stack