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 c++ iterator?
Explain about Virtual Function in C++?
Write a program to find the Factorial of a number
Is it legal in c++ to overload operator++ so that it decrements a value in your class?
What is istream c++?
What is the difference between while and do while loop? Explain with examples.
What is a rooted hierarchy?
Can I have a reference as a data member of a class? If yes, then how do I initialise it?
What is function overriding?
what is the use of void main() in C++ language?
Evaluate: int fn(int v) { if(v==1 || v==0) return 1; if(v%2==0) return fn(v/2)+2; else return fn(v-1)+3; } for fn(7); a) 10 b) 11 c) 1
What is the correct syntax for inheritance a) class aclass : public superclass b) class aclass inherit superclass c) class aclass <-superclass