#import <Foundation/Foundation.h>
int main(int argc, const char * argv[]) {
@autoreleasepool {
NSLog(@"请输入三个整数,按逗号分隔");
int num1,num2,num3;
scanf("%d,%d,%d,",&num1,&num2,&num3);
int max = num1>num2?(num1>num3?num1:num3):(num2>num3?num2:num3);
int min = num1>num2?(num2>num3?num3:num2):(num1>num3?num3:num1);
int center = num1>num2?(num2>num3?num2:num3):(num1>num3?num1:num3);
NSLog(@"最大值为:%d",max);
NSLog(@"最小值为:%d",min);
NSLog(@"居于中间值为:%d",center);
}
return 0;
}
|
|