Created
April 11, 2015 04:42
-
-
Save mobeigi/98e17ae0521957b307e1 to your computer and use it in GitHub Desktop.
Print 100 to 1
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
/* | |
* Question/Challenge from: http://www.thousandtyone.com/blog/EasierThanFizzBuzzWhyCantProgrammersPrint100To1.aspx | |
* | |
* Task: Print 100 to 1. | |
* Start code with "for(int i=0;". | |
* You cannot write anything before "for(int i=0;". | |
* You cannot use two loops. | |
* | |
* Time to complete: 30 seconds | |
*/ | |
#include <iostream> | |
int main() | |
{ | |
for (int i = 0; i < 100; ++i) | |
std::cout << (100 - i) << std::endl; | |
return 0; | |
} |
Sign up for free
to join this conversation on GitHub.
Already have an account?
Sign in to comment