fork download
  1. #include<stdio.h>
  2.  
  3. int main()
  4. {
  5. int a[10];
  6. int i,k;
  7. int element;
  8. //printf("enter array elements:");
  9. for(i=0;i<5;i++)
  10. scanf("%d",&a[i]);
  11. //printf("enter the element you want to insert:");
  12. scanf("%d",&element);
  13. for(k=5;k>0;k--)
  14. a[k]=a[k - 1];
  15. a[0]=element;
  16. printf("\n");
  17. for(i=0;i<6;i++)//display the result
  18. printf("%d \t",a[i]);
  19. return 0;
  20. }
Success #stdin #stdout 0s 2252KB
stdin
10
20
30
40
50

45
stdout
45 	10 	20 	30 	40 	50