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 are friend classes? What are advantages of using friend classes?
What is the identity function in c++? How is it useful?
What is the use of the this pointer?
Can we distribute function templates and class templates in object libraries?
What is the difference between inline functions and macros?
Explain the auto storage classes in c++.
What is data abstraction? How is it different from data encapsulation?
What do you understand by a pure virtual member function?
When is the last time you coded in C/C++? What is the most lines of original C/C++ code you have personally written in one project? How confident are you in your ability to write C or C++ without a reference?
Why #include is used?
Define a pdb file.
What are features of c++?