任务和代码:
<pre name="code" class="cpp">/*
*Copyright (c)2015 CSDN学院
*All rights reserved
*文件名字:main.c
*作者:修红国
*完成日期:2015年11月4日
*版本号:V1.0
* 问题描述:输入3个整数,输出其中的最大值。
* 提示:求出两数的大值,再求这个大值与第三数间的大值,为三数最大值
*/
#include <stdio.h>
#include <stdlib.h>
int main( )
{
int a,b,c,iMax;
printf("请输入3个整数:");
scanf("%d %d %d", &a, &b, &c);
if(a>b)
{
iMax=a;
}
else
{
iMax=b;
}
if(c>iMax) //再求出c和max的大值
{
iMax=c;
}
printf("最大值是: %d\n", iMax);
return 0;
}
运行结果:
知识点总结:
输入3个整数,输出其中的最大值
心得:
有些误区 大小转来转去有些迷糊 还好有答案 能对照下 理解了