Skip to content

Instantly share code, notes, and snippets.

@alnorris
alnorris / gist:6562389
Last active December 23, 2015 01:49
FizzBuzz implementation in PHP.
for($i = 1; $i <= 100; $i++) {
if(($i % 3) == 0 || ($i % 5) == 0) {
if(($i % 3) == 0) { echo "Fizz"; }
if(($i % 5) == 0) { echo "Buzz"; }
}
else { echo $i; }
echo "<br />";
}
@alnorris
alnorris / gist:6341976
Created August 26, 2013 14:26
List power of 2 with bitwise shift operater
int main(void) {
int i;
for(i = 1; i < 1024; printf("%d\n", i <<= 1)) {}
return 0;
}