digits of the number separately.
Input Description:
A single line containing an integer.
Output Description:
Print the even and odd integers of the integer in a separate line.
const readline = require('readline');
const inp = readline.createInterface({
input:process.stdin
});
let userInput;
inp.on("line", (data)=>{
userInput = data;
});
let oddArray = [];
let evenArray = [];
inp.on("close", () =>{
let k = userInput.split('');
for(i=0; i<k.length; i++){
if(parseInt(k[i]) % 2 === 0){
evenArray.push(k[i]);
}
else {
oddArray.push(k[i]);
}
}
console.log(evenArray.join(' '));
console.log(oddArray.join(' '));
});
i got error?
Sample Input :
1234
Sample Output :
2 4
1 3