Re:Fizz Buzz codegolf challenge in 15 languages
by dheerajrav on Friday December 14, 2012 @01:08PM
(#4922254)
process.stdin.resume();
process.stdin.setEncoding('ascii');
process.stdin.on('data', function (input) { numbers = input.split("\n"); sum = parseInt(numbers[0]) + parseInt(numbers[1]) process.stdout.write(sum+"\n"); });
this is a sample code that takes a two digit integer and prints its sum. Can you use this format and see if it works?
Re:Fizz Buzz codegolf challenge in 15 languages
by ddrmaxgt37 on Friday December 14, 2012 @12:17PM
(#4921959)
I'm wondering the same thing...
Re:Fizz Buzz codegolf challenge in 15 languages
by idlecool on Friday December 14, 2012 @12:35PM
(#4922080)
`console.log` works fine.
Re:Fizz Buzz codegolf challenge in 15 languages
by ricardobeat on Friday December 14, 2012 @12:40PM
(#4922114)
What is wrong with this then (not my entry):
process.stdin.resume();
process.stdin.setEncoding("ascii");
process.stdin.on("data", function (input) {
var output = ''
if (input % 3 === 0){
output += 'Fizz'
}
if (input % 5 === 0){
output += 'Buzz'
}
console.log(output || input)
});
Testing locally with for(i=1;i<=30;i++){
process.stdin.emit('data', i.toString())
}
process.stdin.destroy()
gives the correct results.
Re:Fizz Buzz codegolf challenge in 15 languages
by dheerajrav on Friday December 14, 2012 @01:17PM
(#4922307)
There is no input. You have to print the desired result for all numbers between 1-100
Re:Fizz Buzz codegolf challenge in 15 languages
by ricardobeat on Friday December 14, 2012 @01:28PM
(#4922361)
Really? I just wasted 20 minutes trying to figure out whatever that boilerplate was supposed to receive :/
Other issues:
- The "Solve FizzBuzz" button doesn't go anywhere if you are logged in, neither does "The Scenario" up top.
- Forum doesn't work (please fill in all the required fields - they already are)
- Signout link doesn't work