c how to program 习题2.19

发布于2020-03-12 990 热度

//c how to program 习题2.19
#include <stdio.h>

int main(void)
{
	int x, y, z;
	printf("请输入三个不同的整数:");
	scanf("%d%d%d", &x, &y, &z);
	printf("Sum is %d\n", x+y+z);
	printf("Average is %d\n", (x+y+z)/3);
	printf("Produce is %d\n", x*y*z);

	int smallest, largest;
	if(x > y){
		largest = x;
		smallest = y;
	}
	if(x < y){
		largest = y;
		smallest = x;
	}
	if(z > largest){
		largest = z;
	}
	if(z < smallest){
		smallest = z;
	}
	printf("Smallest is %d\n", smallest);
	printf("largest is %d\n", largest);
}

记录工作,记录学习,分享知识,分享经验……