#include<stdio.h>
void main()
{
int a[11],c,k,i;
printf("Enter the elements of the array:");
for(i=0;i<10;i++)
scanf("%d",&a[i]);
printf("Enter the position where you want to insert an element:");
scanf("%d",&k);
printf("Enter the element you want to insert:");
scanf("%d",&c);
for(i=10;i>=k;i--)
{
a[i]=a[i-1];
}
a[k-1]=c;
printf("The new array is \n");
for(i=0;i<11;i++)
{
printf("%d ",a[i]);
}
getch();
}
void main()
{
int a[11],c,k,i;
printf("Enter the elements of the array:");
for(i=0;i<10;i++)
scanf("%d",&a[i]);
printf("Enter the position where you want to insert an element:");
scanf("%d",&k);
printf("Enter the element you want to insert:");
scanf("%d",&c);
for(i=10;i>=k;i--)
{
a[i]=a[i-1];
}
a[k-1]=c;
printf("The new array is \n");
for(i=0;i<11;i++)
{
printf("%d ",a[i]);
}
getch();
}
Good Sattu... way to go
ReplyDelete:)
Will be interesting if you solve some cute [interesting] stuff too...
Interesting means..?
ReplyDelete