A Collection of Code Snippets in as Many Programming Languages as Possible
This project is maintained by TheRenegadeCoder
Welcome to the Baklava 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() {
@autoreleasepool {
const NSInteger radius = 10;
for (NSInteger i = -radius; i <= radius; i++) {
NSUInteger paddingCount = (NSUInteger)labs(i);
NSUInteger starCount = (radius - paddingCount) * 2 + 1;
NSString* padding = [@"" stringByPaddingToLength:paddingCount
withString:@" "
startingAtIndex:0];
NSString* stars = [@"" stringByPaddingToLength:starCount
withString:@"*"
startingAtIndex:0];
NSString* line = [padding stringByAppendingString:stars];
puts(line.UTF8String);
}
}
return 0;
}
Baklava 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.