1 // maximum common approx. and minimum common multiples 2 then SC = new then (system. in); 3 if (SC. hasnextint () {4 int n = SC. nextint (); 5 Int M = SC. nextint (); 6 int A = 0; 7 int Gy = 0; 8 If (M> N) {9 A = N; 10} else {11 A = m; 12} 13 for (INT I = 1; I <= A; I ++) {14 if (N % I = 0 & M % I = 0) {15 Gy = I; 16} 17} 18 system. out. println ("+ Gy); 19 system. out. println (the minimum public multiples of N + "and" + M + "are:" + N * m/Gy); 20 21} else {22 system. out. println ("guasecile! "); 23}
// Monkey peach problem int peach = 1; for (INT I = 0; I <9; I ++) {peach = (peach + 1) * 2;} system. out. println (peach );
// For (INT I = 0; I <100; I ++) {for (Int J = 1; j <33; j ++) {for (int K = 0; k <20; k ++) {if (I % 3 = 0 & I/3 + J * 3 + K * 5 = 100 & I + J + k = 100) {system. out. println ("chicken:" + I + "hen" + J + "Rooster" + k );}}}}
// Print the prime number of 1--100 for (INT I = 2; I <100; I ++) {Boolean tab = true; For (Int J = 1; j <= I; j ++) {if (I % J = 0 & J! = 1 & I! = J) {tab = false ;}}if (Tab) {system. Out. println (I );}}
Maximum and minimum common number, monkey peach eating problem, chicken problem, print a prime number of 1-