我写了这段代码,我想将数字z格式化为百分比.
float l = ([textField2.text floatValue]);
float g = ([textField1.text floatValue]);
float x = l/1.23;
float y = x-g;
float z = y/l;
label.text = [[NSString alloc] initWithFormat:@"%2.2f \%",z];
Run Code Online (Sandbox Code Playgroud)