Page 289 - computer science (868) class 11
P. 289

33                  }
                   34              }

                   35              else
                   36              {

                   37                  System.out.println(n+" not found");
                   38              }

                   39          }
                   40      }


                 The output of the preceding program is as follows:
                 Output 1:
                 Enter a number: 23
                 Enter a number: 24
                 Enter a number: 25
                 Enter a number: 26
                 Enter a number: 27
                 Enter a number to be deleted:
                 25
                 23 24 26 27 0

                 Output 2:
                 Enter a number: 23
                 Enter a number: 36
                 Enter a number: 65
                 Enter a number: 45
                 Enter a number: 47

                 Enter a number to be deleted:
                 32
                 32 not found

                     10.7 MERGING
                 Merging is the process of combining two or more arrays. It maintains the order of both arrays in the merged array. For
                 example, 1, 2, 3 and 4 are the elements of the first array and 8, 9, 10 and 11 are the elements of the second array. Then
                 1, 2, 3, 4, 8, 9, 10 and 11 are the elements of the new merged array.

                 Here two array elements are merged and a new array is created. Suppose the two arrays are ar1 and ar2.

                                     Index         0          1           2           3           4
                                      Ar1         10          5           14          7          66

                                     Index         0          1           2
                                      Ar2         11          22          33






                                                                                                                       287
                                                                                                              Arrays   287
   284   285   286   287   288   289   290   291   292   293   294