I made this code below:
#include <stdio.h>
#include <stdlib.h>
main()
{
int n, i, v[1000];
printf("Type the size of the vector: ");
scanf("%d", &n);
for (i = 0; i < n; i++) {
printf("Type a number: ");
scanf("%d", &v[i]);
}
for(i=0;i<n;i++){
printf ("%d ", v[i]);
}
system ("pause");
return 0;
}
It is working, but what I need to do now is to put another number right in the middle of this vector. So if you put 4 numbers on it, 1, 2, 3 and 4 for example, I need to make it possible to put another number in the middle, so it would be 1, 2, 9, 3 and 4 for example. Does anyone know how to do that?
1 Answer