Page 472 - CA_Blue( J )_Class10
P. 472

Enter a number : 9
              Enter a number : 3
              Enter a number : 4
              Enter a number : 5
              Enter a number : 6
              Enter a number : 7

              Enter a number : 8
              Enter a number : 3
              1   4
               6 7
               3 4
              6   3
              Sum of diagonals :34

                                                         Variable Description
                  NAME        DATATYPE                                    DESCRIPTION
               a[][]         int[][]      Array to store given numbers
               i             int          Loop variable for number of rows
               j             int          Loop variable for number of columns

               sum           Int          To store the sum of the diagonals


                   PROGRAMS ON STRING HANDLING
              (a)  Program based on the string method mentioned in the scope of the syllabus.

              (b)  Programs based on extracting the characters from a given string and manipulating the same.

                             Write a program to accept the name of a person's first, middle and last names and print its short
                Program 13   form.
                             Sample Input - Subhash Chandra Bose
                             Sample Output - S.C.Bose

                 1      import java.util.*;           //importing package "util"

                 2      class shortform             // Declaration of class
                 3      {

                 4          public static void main()
                 5          {

                 6              Scanner sc=new Scanner(System.in);
                 7              String name, abbname="";         //Declaration of variables

                 8              char ch;
                 9              int space, i;

                10              System.out.print("Enter full name : ");





                470470  Touchpad Computer Applications-X
   467   468   469   470   471   472   473   474   475   476   477