Advertisement
Imran1107048

Insert An Element

Aug 23rd, 2020
47
0
Never
Not a member of Pastebin yet? Sign Up, it unlocks many cool features!
text 0.42 KB | None | 0 0
  1. #include<stdio.h>
  2.  
  3. int main()
  4. {
  5. int array[20];
  6. printf("Enter 20 elements: ");
  7. for(int i=1;i<=20;i++){
  8. scanf("%d",&array[i]);
  9. }
  10. printf("\nEnter the element which you want to insert at 6th position: ");
  11. int n;
  12. scanf("%d",&n);
  13. array[6] = n;
  14. printf("\nNew array: ");
  15. for(int i=1;i<=20;i++){
  16. printf("%d ",array[i]);
  17. }
  18. printf("\n");
  19. return 0;
  20. }
  21.  
Advertisement
Add Comment
Please, Sign In to add comment
Advertisement