Skip to content

Instantly share code, notes, and snippets.

@mos3abof
Created April 10, 2015 02:18
Show Gist options
  • Save mos3abof/11c41a1380a08f263031 to your computer and use it in GitHub Desktop.
Save mos3abof/11c41a1380a08f263031 to your computer and use it in GitHub Desktop.
<?php
/**
* A quick solution for the question in this blog post:
* http://www.thousandtyone.com/blog/EasierThanFizzBuzzWhyCantProgrammersPrint100To1.aspx
*
* Took me 30 seconds, without the comments.
*
* The problem:
* Print 100 to 1.
* You need to start with "for(int i=0;" and continue from there.
* You cannot write anything before "for(int i=0;".
* You can't use two loops.
*
* To run it use this command:
* php 100_countdown.php
*/
for($i = 0; $i < 100; $i++)
{
print (100 - $i) . "\n";
}
@LudgerPeters
Copy link

you are wrong. its

for($i = 0; $i < 1; $i++)
{
    print "100 to 1";
}

😆

@mos3abof
Copy link
Author

LOOOL :D

Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment