博客
关于我
强烈建议你试试无所不能的chatGPT,快点击我
[Java]输入3个数字,求最大值并输出
阅读量:3940 次
发布时间:2019-05-24

本文共 477 字,大约阅读时间需要 1 分钟。

import java.util.Scanner;public class Max {	//输入3个数字,求最大值并输出	public static void main(String[] args) {		// 读取键盘输入信息		Scanner s = new Scanner(System.in);		// 提示输入3个数字		System.out.println("请输入3个数字");		// 定义a,b,c的值		int a = s.nextInt();		int b = s.nextInt();		int c = s.nextInt();		// 声明最大值为max		int max;		// 比较a和b最大的值为max		if (a > b) {			max = a;		} else {			max = b;		}		// a和b中的最大值max再和c比较,若比c小,则max为c		if (c > max) {			max = c;		}		// 输出结果		System.out.println("最大值是" + max);	}}

转载地址:http://qvnwi.baihongyu.com/

你可能感兴趣的文章
文章中运用到的数学公式
查看>>
Projective Dynamics: Fusing Constraint Projections for Fast Simulation
查看>>
从2D恢复出3D的数据
查看>>
glm 中 数据类型 与 原始数据(c++ 数组)之间的转换
查看>>
Derivatives of scalars, vector functions and matrices
查看>>
the jacobian matrix and the gradient matrix
查看>>
VS2010 将背景设为保护色
查看>>
ubutun里面用命令行安装软件
查看>>
ubuntu 常用命令
查看>>
SQLite Tutorial 4 : How to export SQLite file into CSV or Excel file
查看>>
Optimizate objective function in matrix
查看>>
Convert polygon faces to triangles or quadrangles
查看>>
read obj in matlab
查看>>
find out the neighbour matrix of a mesh
查看>>
Operators and special characters in matlab
查看>>
As-Conformal-As-Possible Surface Registration
查看>>
qmake Variable Reference
查看>>
Lesson 2 Gradient Desent
查看>>
find border vertex
查看>>
matlab sliced variable
查看>>