题解 | 最大最小值

最大最小值

https://www.nowcoder.com/practice/051cbca4504d40f5b20bb891d83ec408

#include <stdio.h>

int main() {
	int a = 0;
	int b = 0;
	int c = 0;
	scanf("%d %d %d", &a, &b, &c);
	if (a > b) {
		if (a > c) {
			printf("The maximum number is : %d\n", a);
			if (b > c) {
				printf("The minimum number is : %d", c);
			}
			else {
				printf("The minimum number is : %d", b);
			}
		}
		else {
			printf("The maximum number is : %d\n", c);
			printf("The minimum number is : %d", b);
		}
	}
	else if (b > c) {
		printf("The maximum number is : %d\n", b);
		if (a > c) {
			printf("The minimum number is : %d", c);
		}
		else {
			printf("The minimum number is : %d", a);
		}
	}
	else {
		printf("The maximum number is : %d\n", c);
		printf("The minimum number is : %d", a);
	}
	return 0;
}

全部评论

相关推荐

评论
点赞
收藏
分享

创作者周榜

更多
牛客网
牛客网在线编程
牛客网题解
牛客企业服务