Im trying to make a button that calculates the factorial of the number interred into a textfield,
is there a way to do this with Xcode, the ! sign docent work is there some kind of formula i can use to find the factorial of a number using Xcode
thats what i done but its not working
.h
.m
is there a way to do this with Xcode, the ! sign docent work is there some kind of formula i can use to find the factorial of a number using Xcode
thats what i done but its not working
.h
Code:
@property (weak) IBOutlet NSTextField *Field;
- (IBAction)Calculate:(id)sender;
.m
Code:
- (IBAction)Calculate:(id)sender
{
float result = ([_Field floatValue] * ([_Field floatValue]-1)*[_Field floatValue]);
[_Field setFloatValue:result];
}
Last edited: