fork download
  1. process.stdin.resume();
  2. process.stdin.setEncoding('utf8');
  3.  
  4.  
  5. let inputString = '';
  6. let currentLine = 0;
  7.  
  8. process.stdin.on('data', inputStdin => {
  9. inputString += inputStdin;
  10. });
  11.  
  12. process.stdin.on('end', _ => {
  13. inputString = inputString.trim().split('\n').map(string => {
  14. return string.trim();
  15. });
  16.  
  17. checkIfDivisibleBy2(parseInt(inputString[0]));
  18. });
  19.  
  20. function checkIfDivisibleBy2(n){
  21. // use process.stdout.write("hello") to print the output
  22. if(n%2===0)
  23. process.stdout.write("divisible")
  24. else
  25. process.stdout.write("not divisible")
  26. }
Success #stdin #stdout 0.06s 35656KB
stdin
12
stdout
divisible