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
total amount of milk produced each morning and then calculates and outputs the number of cartons needed for this milk , the cost of producing the milk and the profit from producing this milk.
What is abstract keyword in c++?
Would you rather wait for quicksort, linear search, or bubble sort on a 200000 element array? (Or go to lunch...) a) Quicksort b) Linear Search c) Bubble Sort
What is microsoft c++ redistributable?
Define friend function.
What is a class template?
What is c++ array?
What do you mean by translation unit in c++?
How do I run c++?
What is c++ hiding?
Explain the advantages of using friend classes.
What is the difference between while and do while loop?
Is c++ slower than c?
What is the difference between the parameter to a template and the parameter to a function?
Explain how to initialize a const data member.