Want to read Slashdot from your mobile device? Point it at m.slashdot.org and keep reading!

 



Forgot your password?
typodupeerror
DEAL: For $25 - Add A Second Phone Number To Your Smartphone for life! Use promo code SLASHDOT25. Also, Slashdot's Facebook page has a chat bot now. Message it for stories and more. Check out the new SourceForge HTML5 internet speed test! ×
User Journal

Journal DarkKnightRadick's Journal: My Tribute to Douglas Adams 1

#!/usr/bin/perl -w
#I have a feeling the answer will be 42

print "I have a feeling the answer will be the answer to Life! The Universe! And Everything!\n";
print "Please input the first number:";
chomp($first_num = <stdin>);
print "Please input the second number:";
chomp($second_num = <stdin>);
$answer = $first_num * $second_num;

if ($answer != 42) {
print "$first_num times $second_num is not the answer to Life! The Universe! And Everything! It's actually just $answer\n";
} else {
print "You know the answer to Life! The Universe! And Everything!\n";
}
This discussion has been archived. No new comments can be posted.

My Tribute to Douglas Adams

Comments Filter:

"Probably the best operating system in the world is the [operating system] made for the PDP-11 by Bell Laboratories." - Ted Nelson, October 1977

Working...