#include <stdio.h>
#include<conio.h>
void main()
{
int a[100], loc, i, n;
printf("Enter size of elements:-\n");
scanf("%d", &n);
printf("Enter elements\n");
for ( i = 0 ; i < n ; i++ )
scanf("%d", &[i]);
printf("Enter the location");
scanf("%d", &loc);
if ( loc >= n+1 )
printf("Deletion not possible.\n");
else
{
for ( i = loc- 1 ; i < n - 1 ; i++ )
a[i] = a[i+1];
printf("new array is:-\n");
for( i = 0 ; i < n - 1 ; i++ )
printf("%d\n", a[i]);
}
}
#include<conio.h>
void main()
{
int a[100], loc, i, n;
printf("Enter size of elements:-\n");
scanf("%d", &n);
printf("Enter elements\n");
for ( i = 0 ; i < n ; i++ )
scanf("%d", &[i]);
printf("Enter the location");
scanf("%d", &loc);
if ( loc >= n+1 )
printf("Deletion not possible.\n");
else
{
for ( i = loc- 1 ; i < n - 1 ; i++ )
a[i] = a[i+1];
printf("new array is:-\n");
for( i = 0 ; i < n - 1 ; i++ )
printf("%d\n", a[i]);
}
}
No comments :
Post a Comment