Skip to main content

Posts

Showing posts from March, 2018

Two Dimensional Array Sorting: By User Selected Column

SORTING A TWO DIMENSIONAL ARRAY COLUMN WISE AIM:      Take a Two Dimensional array. Each row corresponds to a student and columns correspondingly represents the Roll Number. Marks in English ,Marks in Math and Marks in Hindi. Take all the inputs from the user. Provide a choice to the user of sorting this two dimensional array on the basis of any of the four columns, i.e., sorting can be done on Roll. no. or any of the three marks.In case more than  one student has scored same marks then the lashing is resolved using Roll. no. For Example: Input :                     By  Column 1:         By Column 2: 2 50 60 40               1 50 40 30               4 20 60 60 1 50 40 30               2 50 60 40               3 40 50 40  4 20 60 60               3 40 50 40               1 50 40 30 3 40 50 40               4 20 60 60               2 50 60 40 CODE:

ISC 2018 Practical Question: 3

ISC 2018 Q.03 SYNTAX

Pattern: Inverse Pyramid Of Stars

Pattern: Inverse Pyramid Aim:    TO Print An Inverse Pyramid of Stars Using JAVA.  Get the User Input of No. of Stars and Print Following pattern. Output:  6  * * * * * *   * * * * *    * * * *     * * *      * *       * Syntax:    import java. util .*; class pyramid_inverse {     public static void main(String args[])     {         int n;         Scanner scanner=new Scanner(System.in);         System.out.println(" Enter A Number ");         n=scanner.nextInt();         for(int i=1;i<=n;i++)         {             for(int j=1;j<i;j++)             {                 System.out.print(" ");             }             for(int k=n;k>=i;k--)              {             System.out.print(" * ");                 }             System.out.println();     } } }