第七讲 项目2-三数最大值
2015-11-04 01:46
330 查看
任务和代码:
<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个整数,输出其中的最大值
心得:
有些误区 大小转来转去有些迷糊 还好有答案 能对照下 理解了
<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个整数,输出其中的最大值
心得:
有些误区 大小转来转去有些迷糊 还好有答案 能对照下 理解了
相关文章推荐
- IOS控制器管理详细解读
- 游标
- 最近项目的几个问题
- tomcat实现session集群及tomcat+memcached共享session存储(四)
- Android中实现Bitmap在自定义View中的放大与拖动
- 关于android R.layout 中找不到已存在的布局文件问题的解决
- Nginx 限流
- 使用函数输出一个整数的逆序数
- PHP删除数组元素
- 网络请求例子
- win7 32bit下安装mysql server
- nginx或httpd实现负载均衡tomcat(三)
- 链接库
- Callable从任务中产生返回值
- mariaDB存储引擎,并发控制,事务
- 【iOS学习笔记】iOS ⾃自定义cell的步骤
- linux shell基础(1)
- [数据挖掘课程笔记]无监督学习——聚类(clustering)
- 参数估计
- 实现 strupr