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
What is constructor and destructor in c++?
What is the identity function in c++? How is it useful?
What are special characters c++?
What are the advantages of prototyping?
What is endianness?
How many keywords are used in c++?
Which software is best for c++ programming?
What do you understand by pure virtual function? Write about its use?
Describe the syntax of single inheritance in C++?
Define private, protected and public access control.
What is the difference between a type-specific template friend class and a general template friend class?
Function can be overloaded based on the parameter which is a value or a reference. Explain if the statement is true.
What is prototype for that c string function?
Why is it called c++?
How will you call C functions from C ++ and vice-versa?