Skip to content

Instantly share code, notes, and snippets.

@mobeigi
Created April 11, 2015 04:42
Show Gist options
  • Save mobeigi/98e17ae0521957b307e1 to your computer and use it in GitHub Desktop.
Save mobeigi/98e17ae0521957b307e1 to your computer and use it in GitHub Desktop.
Print 100 to 1
/*
* 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