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 is runtime errors c++?
Which bitwise operator is used to check whether a particular bit is on or off?
What is the basic structure of a c++ program?
What is an undefined behavior and sequence points
What is size of empty class object
What are the main differences between C and C++?
what is the size of this class class size { public: char data1; double d; int data2; char data3; double data4; short data5; }; please explain the padding for these double variables.
What is private public protected in c++?
What are C++ inline functions?
What is an ABC: an "Abstract Base Class"?
Is c++ vector dynamic?
How would you use qsort() function to sort an array of structures?