#include <stdio.h>
#include<conio.h>
void main()
{
int a[100],loc, i, n, element;
printf("Enter size of array:-");
scanf("%d", &n);
printf("Enter the elements:");
for (i = 0; i < n; i++)
scanf("%d", &a[i]);
printf("Enter the location :-\n");
scanf("%d", &loc);
printf("Enter the value to insert\n");
scanf("%d", &element);
for (i = n - 1; i >= position - 1; i--)
a[i+1] = a[i];
a[loc-1] = element;
printf("New array is\n");
for (i= 0; i <= n; i++)
printf("%d\n", a[c]);
}
#include<conio.h>
void main()
{
int a[100],loc, i, n, element;
printf("Enter size of array:-");
scanf("%d", &n);
printf("Enter the elements:");
for (i = 0; i < n; i++)
scanf("%d", &a[i]);
printf("Enter the location :-\n");
scanf("%d", &loc);
printf("Enter the value to insert\n");
scanf("%d", &element);
for (i = n - 1; i >= position - 1; i--)
a[i+1] = a[i];
a[loc-1] = element;
printf("New array is\n");
for (i= 0; i <= n; i++)
printf("%d\n", a[c]);
}
No comments :
Post a Comment