Calculator in iOS

Calculator in iOS

ViewController.h

#import 
int method;
int selectno;
float runningtotal;
@interface ViewController : UIViewController
{
    IBOutlet UITextField *display;
}
-(IBAction)number1:(id)sender;
-(IBAction)number2:(id)sender;
-(IBAction)number3:(id)sender;
-(IBAction)number4:(id)sender;
-(IBAction)number5:(id)sender;
-(IBAction)number6:(id)sender;
-(IBAction)number7:(id)sender;
-(IBAction)number8:(id)sender;
-(IBAction)number9:(id)sender;
-(IBAction)number0:(id)sender;
- (IBAction)multi:(id)sender;
-(IBAction)div:(id)sender;
-(IBAction)sub:(id)sender;
-(IBAction)plus:(id)sender;
-(IBAction)equal:(id)sender;
-(IBAction)clear:(id)sender;
- (IBAction)btnremove:(id)sender;
@end

ViewController.m

#import "ViewController.h"
@interface ViewController ()
@end

@implementation ViewController
-(IBAction)number1:(id)sender
{
    selectno= selectno *10;
    selectno=selectno +1;
    display.text=[NSString stringWithFormat:@"%i",selectno];
}
-(IBAction)number2:(id)sender
{
    selectno= selectno *10;
    selectno=selectno +2;
    display.text=[NSString stringWithFormat:@"%i",selectno];
}
-(IBAction)number3:(id)sender
{
    selectno= selectno *10;
    selectno=selectno +3;
    display.text=[NSString stringWithFormat:@"%i",selectno];
}
-(IBAction)number4:(id)sender
{
    selectno= selectno *10;
    selectno=selectno +4;
    display.text=[NSString stringWithFormat:@"%i",selectno];
}
-(IBAction)number5:(id)sender
{
    selectno= selectno *10;
    selectno=selectno +5;
    display.text=[NSString stringWithFormat:@"%i",selectno];
}
-(IBAction)number6:(id)sender
{
    selectno= selectno *10;
    selectno=selectno +6;
    display.text=[NSString stringWithFormat:@"%i",selectno];
}
-(IBAction)number7:(id)sender
{
    selectno= selectno *10;
    selectno=selectno +7;
    display.text=[NSString stringWithFormat:@"%i",selectno];
}
-(IBAction)number8:(id)sender
{
    selectno= selectno *10;
    selectno=selectno +8;
    display.text=[NSString stringWithFormat:@"%i",selectno];
}
-(IBAction)number9:(id)sender
{
    selectno= selectno *10;
    selectno=selectno +9;
    display.text=[NSString stringWithFormat:@"%i",selectno];
}
-(IBAction)number0:(id)sender
{
    selectno= selectno *10;
    selectno=selectno +0;
    display.text=[NSString stringWithFormat:@"%i",selectno];
}
- (IBAction)multi:(id)sender {
    if (runningtotal==0)
    {
        runningtotal=selectno;
    }
    else
    {
        switch (method)
        {
            case 1:
                runningtotal=runningtotal*selectno;
                break;
            case 2:
                runningtotal=runningtotal/selectno;
                break;
            case 3:
                runningtotal=runningtotal-selectno;
                break;
            case 4:
                runningtotal=runningtotal+selectno;
                break;
            default:
                break;
        }
    }
    method=1;
    selectno=0;
}
-(IBAction)div:(id)sender{
    if (runningtotal==0)
    {
        runningtotal=selectno;
    }
    else
    {
        switch (method)
        {
            case 1:
                runningtotal=runningtotal*selectno;
                break;
            case 2:
                runningtotal=runningtotal/selectno;
                break;
            case 3:
                runningtotal=runningtotal-selectno;
                break;
            case 4:
                runningtotal=runningtotal+selectno;
                break;
            default:
                break;
        }
    }
    method=2;
    selectno=0;
}
-(IBAction)sub:(id)sender
{
    if (runningtotal==0)
    {
        runningtotal=selectno;
    }
    else
    {
        switch (method)
        {
            case 1:
                runningtotal=runningtotal*selectno;
                break;
            case 2:
                runningtotal=runningtotal/selectno;
                break;
            case 3:
                runningtotal=runningtotal-selectno;
                break;
            case 4:
                runningtotal=runningtotal+selectno;
                break;
            default:
                break;
        }
    }
    method=3;
    selectno=0;
}
-(IBAction)plus:(id)sender
{
    if (runningtotal==0)
    {
        runningtotal=selectno;
    }
    else
    {
        switch (method)
        {
            case 1:
                runningtotal=runningtotal*selectno;
                break;
            case 2:
                runningtotal=runningtotal/selectno;
                break;
            case 3:
                runningtotal=runningtotal-selectno;
                break;
            case 4:
                runningtotal=runningtotal+selectno;
                break;
            default:
                break;
        }
    }
    method=4;
    selectno=0;
}
-(IBAction)equal:(id)sender{
    if (runningtotal==0)
    {
       runningtotal=selectno;
    }
    else
    {
        switch (method)
        {
            case 1:
                runningtotal=runningtotal*selectno;
                break;
            case 2:
                runningtotal=runningtotal/selectno;
                break;
            case 3:
                runningtotal=runningtotal-selectno;
                break;
            case 4:
                runningtotal=runningtotal+selectno;
                break;
            default:
                break;
        }
    }
    method=0;
    selectno=0;
    display.text=[NSString stringWithFormat:@"%.2f",runningtotal];
}
-(IBAction)clear:(id)sender
{
    method=0;
    runningtotal=0;
    selectno=0;
    display.text=[NSString stringWithFormat:@"0"];
}
- (IBAction)btnremove:(id)sender
{
    if ([display.text length]>0)
    {
        NSString *lastdigit=[display.text substringFromIndex:[display.text length]-1];
        int lastnumber= [lastdigit intValue];
        selectno=selectno-lastnumber;
        selectno=selectno/10;
        display.text=[display.text substringToIndex:[display.text length]-1];
    }
}
- (void)viewDidLoad
{
    [super viewDidLoad];
// Do any additional setup after loading the view, typically from a nib.
    }
- (void)didReceiveMemoryWarning
{
    [super didReceiveMemoryWarning];
    // Dispose of any resources that can be recreated.
}
@end