Last active
August 29, 2015 14:16
-
-
Save chrisswong/aab2321ad88c6d0383cd to your computer and use it in GitHub Desktop.
FizzBuzz Test in Obj-C (for loop)
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
for (int i = 1 ; i <= 100; i++) { | |
if ( i % 3 == 0 || i % 5 == 0 ) { | |
if (i % 3 == 0 && i % 5 == 0 ) { | |
NSLog(@"FizzBuzz"); | |
} | |
else { | |
if (i % 3 == 0) { | |
NSLog(@"Fizz"); | |
} | |
if (i % 5 == 0) { | |
NSLog(@"Buzz"); | |
} | |
} | |
} else { | |
NSLog(@"%d\n", i); | |
} | |
} |
Sign up for free
to join this conversation on GitHub.
Already have an account?
Sign in to comment