Page 293 - CA_Blue( J )_Class9
P. 293

28              }
                  29          }

                  30      }
                 You will get the following output:

                        Enter m : 5
                        Enter n : 15
                        The factors of all the numbers between 5 and 15 :

                        The factors of 5 are : 1 5
                        The factors of 6 are : 1 2 3 6
                        The factors of 7 are : 1 7
                        The factors of 8 are : 1 2 4 8

                        The factors of 9 are : 1 3 9
                        The factors of 10 are : 1 2 5 10
                        The factors of 11 are : 1 11
                        The factors of 12 are : 1 2 3 4 6 12
                        The factors of 13 are : 1 13
                        The factors of 14 are : 1 2 7 14
                        The factors of 15 are : 1 3 5 15

                                                        VARIABLE DESCRIPTION
                           NAME               DATATYPE                           DESCRIPTION
                       m                int                   Accept a number to start
                       i                int                   Loop Variable
                       s                int                   Sum of the series
                       n                int                   Accept a number to end
                       j                int                   Loop Variable


                                 Write a program to find the biggest and smallest number from n number of entered
                  Program 16
                                 numbers.
                   1      import java.util.*;                                  //importing “util”package
                   2      class largesmall                                     //class name

                   3      {
                   4          public static void main()

                   5          {
                   6              Scanner sc= new Scanner(System.in);

                   7              int n,i,s,l,m;                               //Declaration of variable
                   8              System.out.print("Enter n : ");

                   9              n=sc.nextInt();



                                                                                             Internal Assessment  291
   288   289   290   291   292   293   294   295   296   297   298