Last active
August 29, 2015 14:15
-
-
Save mayoff/e2c5be3e2262fbac8c03 to your computer and use it in GitHub Desktop.
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
#import <Foundation/Foundation.h> | |
int main(int argc, const char * argv[]) | |
{ | |
@autoreleasepool { | |
NSMutableArray *myNums = [NSMutableArray array]; | |
NSString *inputs = @"392 392 339 394 393 394 339"; | |
for (NSString *word in [inputs componentsSeparatedByString:@" "]) { | |
NSNumber *n = [NSDecimalNumber decimalNumberWithString:word]; | |
[myNums addObject:n]; | |
} | |
NSNumber *avg = [myNums valueForKeyPath:@"@avg.self"]; | |
int64_t result = avg.longLongValue; | |
if (result < 100) { | |
NSLog(@"result < 100: %lld", result); | |
} else { | |
NSLog(@"result >= 100: %lld", result); | |
} | |
} | |
return 0; | |
} |
Sign up for free
to join this conversation on GitHub.
Already have an account?
Sign in to comment