A Collection of Code Snippets in as Many Programming Languages as Possible
This project is maintained by TheRenegadeCoder
Welcome to the Fizz Buzz in Objective C page! Here, you'll find the source code for this program as well as a description of how the program works.
#import <Foundation/Foundation.h>
int main (int argc, const char *argv[]){
NSAutoreleasePool *pool =[[NSAutoreleasePool alloc] init];
NSMutableString* fizzbuzz = [[NSMutableString alloc] init];
int i;
for (i = 1; i <= 100; ++i) {
[fizzbuzz setString: @""];
if (i % 3 == 0) {
[fizzbuzz appendString: @"Fizz"];
}
if (i % 5 == 0) {
[fizzbuzz appendString: @"Buzz"];
}
if ([fizzbuzz length] != 0) {
printf("%s\n", [fizzbuzz UTF8String]);
} else {
printf("%d\n", i);
}
}
[fizzbuzz release];
[pool drain];
return 0;
}
Fizz Buzz in Objective C was written by:
If you see anything you'd like to change or update, please consider contributing.
No 'How to Implement the Solution' section available. Please consider contributing.
No 'How to Run the Solution' section available. Please consider contributing.