C programs
C program to shift an element by one location to the left in an array of n elements
Write a C program to shift an element by one location to the left in an array of
n elements.
#include<stdio.h>
#include<conio.h>
void main()
{
int
i,n,a[20];
clrscr();
printf("How
Many Numbers You Want To Enter==");
scanf("%d",&n);
printf("\nEnter
%d Numbers\n",n);
for(i=0;i<n;i++)
scanf("%d",&a[i]);
for(i=1;i<n;i++)
a[i-1]=a[i];
printf("\nNumbers
In An Array After Shifting One Places To Left\n");
for(i=0;i<n-1;i++)
printf("%d
",a[i]);
getch();
}
/*Output
How Many Numbers You Want To Enter==3
Enter 3 Numbers
69
54
12
Numbers In An Array After Shifting One
Places To Left
54 12
*/