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
Write a program using merge () function to combine the elements of array x[ ] and y[ ] into array z[ ].
Write down the equivalent pointer expression for referring the same element a[i][j][k][l]?
Which programming language should I learn first?
Does improper inheritance have a potential to wreck a project?
What is the size of integer variable?
What is lambda in c++?
Explain terminate() function?
Can class objects be passed as function arguments?
What does it mean to declare a member function as virtual?
Can turbo c++ run c program?
What will happen if a pointer is deleted twice?
Is eclipse good for c++?
What is array in c++ pdf?
What's the order in which the objects in an array are destructed?
What is the basic structure of c++ program?