Home > Article > Backend Development > How to input two numbers in C language and output the largest number?
Recommended tutorial: "c Video Tutorial"
How to input two numbers in C language and output the largest number?
C language inputs two numbers and outputs the maximum number method: first define two numbers a and b; then make a judgment. If [a>b], the maximum value is a and output a; finally If [a
Example:
#include<stdio.h> int main(void) { int a,b; printf("请两个输入数值,中间用空格隔开:"); scanf("%d%d",&a,&b); if(a>b) {printf("最大值为%d\n",a);} else {printf("最大值为%d\n",b);} }
Recommended related articles: "c#.net development graphic tutorial"
The above is the detailed content of How to input two numbers in C language and output the largest number?. For more information, please follow other related articles on the PHP Chinese website!