Enter n no. of element and delete value from desire position



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

Post New Answer

More C++ General Interview Questions

What do you mean by “this” pointer?

0 Answers  


What is the topic of the C++ FAQ list?

1 Answers  


What are the various access specifiers in c++?

0 Answers  


What issue do auto_ptr objects address?

2 Answers  


What is function overloading in C++?

0 Answers  






Is vector a class in c++?

0 Answers  


To which numbering system can the binary number 1101100100111100 be easily converted to?

0 Answers  


How Virtual functions call up is maintained?

2 Answers  


Why Pointers are not used in C++?

0 Answers   Global Logic,


Which is not an ANSII C++ function a) sin() b) tmpnam() c) kbhit()

0 Answers  


Is map sorted c++?

0 Answers  


What data structure is fastest, on average, for retrieving data: a) Binary Tree b) Hash Table c) Stack

0 Answers  


Categories