比较两数大小

来源:互联网 发布:desmume mac中文 编辑:程序博客网 时间:2024/04/26 00:34

问题及代码:

        输入两个数字,输出较大的数字

代码一:

#include<stdio.h>int main(){    int a,b;    scanf("%d %d",&a,&b);    printf("%d",(a>b)?a:b);    return 0;}


代码二:

#include<stdio.h>int main(){    int a,b;    scanf("%d %d",&a,&b);    if(a<b)        a=b;    printf("%d",a);    return 0;}


运行结果:

知识点总结:

If函数的基本用法

学习心得:

初步掌握IF函数

0 0
原创粉丝点击