又有一个不会的例题 请大家帮着看看 谢谢了 !
main(){
int num1,num2,num3,sum,Average,smallest,product;
printf("input three different integers:");
scanf("%d%d%d",&num1,&num2,&num3);
if (num1>num2>num3) {
printf("smallest is %d\n",num3);
printf("largest is %d\n",num1);
}
if (num1>num3>num2) {
printf("smallest is %d\n",num2);
printf("largest is %d\n",num1);
}
if (num2>num1>num3) {
printf("samllest is %d\n",num3);
printf("largest is %d\n",num2);
}
if (num2>num3>num1) {
printf("samllest is %d\n",num1);
printf("largest is %d\n",num2);
}
if (num3>num1>num2) {
printf("samllest is %d\n",num2);
printf("largest is %d\n",num3);
}
sum = num1+num2+num3;
Average= sum /3;
product= num1*num2*num3;
printf("sum is %d\n",sum);
printf("Average is %d\n",Average);
printf("product is %d\n",product);
return 0;
}
为什么不显示最大数和最小数?
应该怎么办?