kotlin int最大值_Kotlin程序查找三个数字中的最大值
kotlin int最大值
Input 3 integer numbers, we have to find the largest of these input numbers.
输入3个整数,我们必须找到这些输入数字中最大的一个。
Example:
例:
Input:
First number: 10
Second number: 20
Third number: 30
Output:
Largest number: 30
计划在Kotlin查找三个数字中的最大数字 (Program to find largest of three numbers in Kotlin)
package com.includehelp.basic
import java.util.*
// Main Method Entry Point of Program
fun main(args: Array<String>) {
// InputStream to get Input
val reader = Scanner(System.`in`)
// Input Integer values
println("Enter First Value : ")
var first = reader.nextInt()
println("Enter Second Value : ")
var second = reader.nextInt()
println("Enter Third Value : ")
var third = reader.nextInt();
// condition to find largest of three numbers
val largest = if(first>second && first>third)
first
else if(second>third)
second
else
third
println("Largest Number is: $largest")
}
Output
输出量
Enter First Value :
23
Enter Second Value :
45
Enter Third Value :
89
Largest Number is: 89
翻译自: https://www.includehelp.com/kotlin/find-largest-of-three-numbers.aspx
kotlin int最大值
kotlin int最大值_Kotlin程序查找三个数字中的最大值相关推荐
- python求三个数的最大值编程_python 判断三个数字中的最大值实例代码
python 判断三个数字中的最大值,具体代码如下所示: #判断三个数中最大值 n1= int(input('please enter the firest number:')) n2 = int(i ...
- python中if语句求最大值_python 判断三个数字中的最大值实例代码
python 判断三个数字中的最大值,具体代码如下所示: #判断三个数中最大值 n1= int(input('please enter the firest number:')) n2 = int(i ...
- 用python输入三个整数输出最大值_python 判断三个数字中的最大值实例代码
python 判断三个数字中的最大值,具体代码如下所示: #判断三个数中最大值 n1= int(input('please enter the firest number:')) n2 = int(i ...
- Java获取三个数字中的最大值[5种解决方法]
第一种解决方法[if嵌套] public static int getMax1(int a, int b, int c) {int max = 0;if (a > b) {if (a > ...
- js 创建函数getMax,传递3个参数,返回三个数字中的最大值。
创建函数getMax,传递3个参数,返回三个数字中的最大值. function getMax3(a,b,c){ if(a>b && a>c){ return a; }els ...
- kotlin 尾递归阶乘_Kotlin程序查找数字的阶乘
kotlin 尾递归阶乘 Factorial of number is the product of all positive numbers less or equal to the number. ...
- kotlin 或 运算_Kotlin程序对两个数字执行算术运算
kotlin 或 运算 Here, we are implementing a Kotlin program to perform various arithmetic operations on t ...
- 键盘录入三个整数,并将三个数据中的最大值打印在控制台
package cn.zxj.com; import java.util.Scanner; public class Demo { public static void main(String[] a ...
- 宇文成 C语言中求三个值中的最大值
C语言中求三个值中的最大值 #include <stdio.h> //定于有参构造函数 int max(int x,int y); //定义主函数main int main(){ //定义 ...
最新文章
- 不使用vue-cli来创建项目
- .NET Core/标准自动增量版本控制
- Filecoin逻辑梳理及源代码导读
- struts2启动报错com/opensymphony/xwork2/spring/SpringObjectFactory.java:220:-1
- 回顾2007展望2008
- (二)PowerLink理论知识
- Swift 3.0 使用Core Data
- 黑马程序员——Java高新技术枚举和自动装箱
- 阶段5 3.微服务项目【学成在线】_day04 页面静态化_24-页面预览-页面预览测试
- 税务计算机类考试题型,税务师考试题型分值分配、计算器要求及2020年考试时间...
- Linux那些事儿----好的学习网站
- HTML如何画一条分割线_div之间设置间隔
- 徐磊英语 4 5 时态,被动,时态的错误定义
- xmind打不开的问题
- gazebo无人机仿真显示:failsafe enabled: no rc
- Minecraft(我的世界) Fabric 1.19.3 服务器搭建教程
- 蓝桥杯国赛 勾股定理
- nii与nii.gz格式的关系
- 百篇大计敬本年之系统篇《十》 —— 系统文件名长度限制
- MTK Android 11 预装可卸载APP
热门文章
- java中TreeSet集合如何实现元素的判重
- python包mdure_Python hashlib模块实例使用详解
- java异常自定义返回信息,Spring Boot 如何自定义返回错误码错误信息
- axure实现复选框全选_jq简单的全选、反选和全不选效果
- redis哨兵模式没有切换主机_Redis哨兵(Sentinel)模式
- vue tab切换_iviewUITabs选项卡切换组件
- python批量下载文件教程_Python抓包菜鸟教程:批量下载图片的方法,电脑和手机都能用...
- mac wmware 无网络_无线网络中常用的技术名词
- 【Java从入门到头秃专栏 】(二) 注释 数据类型 变量 常量 关键字 标识符 运算符 输入输出
- linux命令复习之有关磁盘空间的命令