How to create this program?? | Sololearn: Learn to code for FREE!
0

How to create this program??

hey guys.. can you help me how to create this program.. "create a program that will ask for the 5 digits and list the odd and even.tnx a lot!..

8th Apr 2017, 9:55 AM
Dexter Torres Gregorio
Dexter Torres Gregorio - avatar
5 odpowiedzi
8th Apr 2017, 3:16 PM
LordHill
LordHill - avatar
+ 1
% <-- your answer lies in this. Make 2 ArrayList. split your 5 digit int into an Array of its own. for loop thru it and for each digit check if it is an even number. if it is add it to your ArrayList of even. else add it to your ArrayList of odd. if(digit%2==0){ evens.add(digit); } else{ odds.add(digit); } something like this. try something and if you can't get it, show us the code your working so we have something to go by.
8th Apr 2017, 12:43 PM
LordHill
LordHill - avatar
+ 1
sir ..I don't know how to use an array.. I am beginner in java. can u show an a source code? tnx for help.
8th Apr 2017, 1:47 PM
Dexter Torres Gregorio
Dexter Torres Gregorio - avatar
0
Yup, give me a sec and I will throw something together
8th Apr 2017, 2:40 PM
LordHill
LordHill - avatar
0
thank you sir.. I appreciate ur help
8th Apr 2017, 2:43 PM
Dexter Torres Gregorio
Dexter Torres Gregorio - avatar