Skip to content

Instantly share code, notes, and snippets.

Created March 4, 2013 19:46
Show Gist options
  • Star 0 You must be signed in to star a gist
  • Fork 0 You must be signed in to fork a gist
  • Save anonymous/5084934 to your computer and use it in GitHub Desktop.
Save anonymous/5084934 to your computer and use it in GitHub Desktop.
//
// 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