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.

Answers were Sorted based on User's Feedback



Write a program that accepts an array of numbers, and two numbers (an element and a position in th..

Answer / 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

Write a program that accepts an array of numbers, and two numbers (an element and a position in th..

Answer / lince

Dim num() As Integer = {5, 3, 6, 7, 1}
num.SetValue(3, 2)

Is This Answer Correct ?    0 Yes 0 No

Post New Answer

More VB.NET Interview Questions

Is it necessary to have SQL server installed in your computer in order to create a service based database in vb.net?

0 Answers  


How to create a constant in vb.net?

0 Answers  


is ADO.NET important to connect sql server? is any other way to connect sql server?

1 Answers  


What is the feature anonymous type?

0 Answers  


What do you mean by serialization?

0 Answers  






What is the difference between c# and vb.net?

0 Answers  


How do you use two datareaders at the same time in a vb.net windows application ?

0 Answers  


Write a VB.Net console program to check whether a number is perfect or not.

1 Answers   Wipro,


Explain internal keyword in .net framework?

0 Answers  


What is the purpose of objects present in asp.net?

0 Answers  


how to save items in gridview and the form name is vendor rating?

1 Answers  


Can we use Vb.Net and C# language simultaneously in one .Net application?

0 Answers   PUCIT,


Categories