Page 507 - Cs_withBlue_J_C11_Flipbook
P. 507
51
52 public static void main()
53 {//start of main
54 Scanner sc =new Scanner(System.in);
55 System.out.println("Enter the size of the array");
56 int s=sc.nextInt();
57 magic ob=new magic(s);
58 ob.input();
59 ob.find_magic();
60 }//end of main
61 }//end of class
The output of the preceding program is as follows:
Enter the size of the array
5
Enter elements one by one in the array
15
16
298
91
54
the magic number is 298
the magic number is 91
Variable Description
NAME TYPE DESCRIPTION
num[][] int[][] Array elements
n int Size of array
d int remainder
t int Temporary Variable
s int Sum of the digits
i int Loop Variable
505
Internal Assessment 505

