Page 95 - CTS - CSA TP - Volume 2
P. 95

COMPUTER SOFTWARE APPLICATION - CITS





           Output:










































           Related Tasks:
              Develop the following java programs:
              1  To display the sum of odd and even numbers in an array

              2  Read ‘n’ elements of an array and display the count of  Zeros, Positive, Negative numbers in the array.
              3  To search the given element is present in the array or not using Linear Search method (If present display
                 the position also)
              4  Read ‘n’elements and store the even and odd numbers in two different arrays and display it.

              5  Develop a program to sort ‘n’ elements in Ascending order using Bubble sort method.
           2  Two Dimensional Arrays in Java
           TASK  1: Here’s a Java program that demonstrates the usage of two-dimensional arrays along with an
                       explanation:
           public class TwoDArrayDemo {
               public static void main(String[] args) {
                   // Declaration and initialization of a 2D array
                   int[][] matrix = { {1, 2, 3},
                                      {4, 5, 6},

                                      {7, 8, 9} };
            // Displaying the elements of the 2D array
                   System.out.println(“Elements of the 2D array:”);




                                                           80

                               CITS : IT & ITES - Computer Software Application - Exercise 93
   90   91   92   93   94   95   96   97   98   99   100