Page 303 - IT-802_class_12
P. 303

{

                           for (int j = i; j <= 5; j++)
                           {
                               System.out.print("* ");
                           }
                           System.out.println();
                       }
                       for (int i = 2; i <= 5; i++)
                       {
                           for (int j = 1; j <= i; j++)
                           {
                               System.out.print("* ");
                           }

                           System.out.println();
                       }
                   }
               }
             Ans. * * * * *
                 * * * *
                 * * *

                 * *
                 *

                 * *
                 * * *
                 * * * *
                 * * * * *

              23.  Write the output of the following program.

                 import java.util.*;
                 class Gcd_lcm
                 {
                     public static void main (String [] args)
                     {
                         Scanner sc = new Scanner (System.in);
                         int s=0 , a, b, g,l;
                         System.out.println(“Enter two numbers: “);
                         a=sc.nextint ();
                         b=sc.nextint ();
                         if(a>b)
                             g = a;
                         else
                             g = b;

                                                                                                Practical Work  301
   298   299   300   301   302   303   304   305   306   307   308