Write a program that accepts an array of numbers, and two
numbers (an element and a
position in the array) and inserts the given element into
nth position of the array.
Answer Posted / surabhi
void main()
{
int x[6],item,pos,i,n;
printf("\n enter no of elements to be inserted:");
scanf("\n %d",&n);
for(i=0;i<n;i++)
{
printf("\n enter elements:");
scanf("%d",&x[i]);
}
printf("\n enter item to be inserted:");
scanf("%d",&item);
printf("\n enter position:");
scanf("%d",&pos);
for(i=n;i<=pos-1;i--)
{
x[i+1]=x[i];
}
x[pos-1]=item;
printf("\n elements after insertion:");
for(i=0;i<=n;i++)
{
printf("\n %d",x[i]);
}
getch();
}
| Is This Answer Correct ? | 3 Yes | 2 No |
Post New Answer View All Answers
What is the use of internal keyword?
Explain and brief about rapid application development tool?
Explain the advantages of migrating to vb.net?
Which control is an example of an object in vb net?
What does assert() method do In VB.NET
my project run very wel in my sytem yhen i am deploying my project on client machine ,after deployment i run my project then it show " can no find server name " what i do .
What are the advantages of an assembly?
Explain the components of common language runtime.
What is an assembly and its use?
What do you mean by serialization and deserialization and it's use.
List the types of authentication?
Explain convert.tostring and i.tostring method?
Write a program to find all text files in a logical drive and return the count of the number of files?
Explain convert.tostrin?
What is late binding and early binding?