0
Solution the exercice
Write a program that keeps reading input from the user as long as the number entered is odd. Once the loop ends due to an even number entered (other than 0), your program should output the minimum odd number entered, the maximum odd number and whether the sum resulting of all these numbers is divisible by the last even number entered or not. Sample run: Enter odd integers (even to stop): 11 9 15 5 3 4 Minimum odd number: 3; Maximum odd number: 15 Sum: 43. 43 is not divisible by 4
15 Respostas
+ 7
Steps to follow-
1) Declare an ArrayList.
2) Use a while loop and take the input from the user as long as the given conditions are met.
3) Sort the ArrayList.
4) Print the first element of the list to get your answer.
+ 3
How much do I set the size of the array
+ 2
You can check if a number is even by using a divisio operator then checking if it equal to 0. But you should also check if number is 0 first.
+ 2
Use a dynamic array like ArrayList.
+ 1
I want help with this sentence once the loop ends due to an even number entered (other than 0)
+ 1
Thank you
+ 1
Ok thank you
+ 1
ok
0
Please attach your attempt to the post. This is not a place to have other people do your work. Try to solve your assignment, then ask for help on sections you're stuck on.
0
Please
0
So kinda like if(num % 2 == 0 && num != 0)
0
Size arry ??
0
?
0
You wouldnt have to use an array. Unless it is specified to. (Whoops I didn't read the assignment thoroughly)
0
I want help in exercise 4.3 comments problem in Java plz help in solution