// Write a function and return the public class test {public static void main (string [] ARGs) result of division of all elements in an array by the first element) {int [] arr1 = {0, 1, 3, 6, 7, 9, 2, 33, 22, 11}; int [] arr2 = {2, 1, 3, 6, 7, 9, 2, 33, 22, 11}; For (int n: arr1) {system. out. print (n + "");} system. out. println (); For (int n: arr2) {system. out. print (n + "");} system. out. println ("\ n after the first number in the array:"); divisor (arr1); divisor (arr2); For (int n: arr1) {system. out. print (n + "");} system. out. println (); For (int n: arr2) {system. out. print (n + "") ;}} static void divisor (INT [] ARR) {If (ARR [0] = 0) {system. out. println ("arr [0] cannot be 0. ");} else {for (INT I = 1, Leng = arr. length-1; I <Leng; I ++) {arr [I] = arr [I]/ARR [0] ;}}}
Output result:
0 1 3 6 7 9 2 33 22 11 2 1 3 6 7 9 2 33 22 11 after removing the first number in the array: arr [0] cannot be 0.0 1 3 6 7 9 2 33 22 11 2 0 1 3 3 4 1 11 11