Home Forums C Programming Insert elements in an array

Viewing 0 reply threads
  • Author
    Posts
    • #1890
      will
      Participant

      #include
      #include
      #includevoid main(){
          int a[10];
          int i,n,j,item,m;
          clrscr();
          textmode(3);
          printf("Enter an array of Ten Elementsn");
          for ( i=1;i<=10;i++)
            scanf("%d",&a);
            printf("The array you enterd wasn");
            for (i=1;i<=10;i++)
                 printf("n%d",a);
             printf("nEnter Element an element to insert in the arrayn");
             scanf("%d",&item );
             printf("nEnter Location (1--10) to insert this elementn");
             scanf("%d",&m) ;
             a[m]=item;
             printf("nThe number wasn%d ",item);
             printf("nLocation wasn%d ",m);
             printf("nUpdated array isn");
             for (i=1;i<=10;i++)
                      printf("%dn ",a);
                  getch();
      }

Viewing 0 reply threads
  • The forum ‘C Programming’ is closed to new topics and replies.