How to input two numbers in C language and output the largest number?

coldplay.xixi
Release: 2020-06-30 09:12:03
Original
34442 people have browsed it

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);}
}
Copy after login

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!

Related labels:
source:php.cn
Statement of this Website
The content of this article is voluntarily contributed by netizens, and the copyright belongs to the original author. This site does not assume corresponding legal responsibility. If you find any content suspected of plagiarism or infringement, please contact admin@php.cn
Popular Tutorials
More>
Latest Downloads
More>
Web Effects
Website Source Code
Website Materials
Front End Template