Create a gist now

Instantly share code, notes, and snippets.

anonymous /gist:5084934
Created Mar 4, 2013

//
// Bytelandian.h
// 121 bytelandian
//
#import <Foundation/Foundation.h>
@interface Bytelandian : NSObject
{
int value;
}
@property int value;
- (id) initWithValue: (int) v;
- (int) CalcChange: (int) n;
@end
//
// Bytelandian.m
// 121 bytelandian
//
#import "Bytelandian.h"
@implementation Bytelandian
@synthesize value;
- (id) initWithValue: (int) v
{
self = [super init];
if (self)
{
[self setValue: v];
}
return self;
}
- (int) CalcChange: (int) n
{
if (n == 0)
return 1;
else
return ([self CalcChange: (n / 2)] +
[self CalcChange: (n / 3)] +
[self CalcChange: (n / 4)]);
}
@end
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment