欢迎访问 生活随笔!

生活随笔

当前位置: 首页 >

kotlin 或 运算_Kotlin程序对两个数字执行算术运算

发布时间:2023/12/1 54 豆豆
生活随笔 收集整理的这篇文章主要介绍了 kotlin 或 运算_Kotlin程序对两个数字执行算术运算 小编觉得挺不错的,现在分享给大家,帮大家做个参考.

kotlin 或 运算

Here, we are implementing a Kotlin program to perform various arithmetic operations on two numbers.

在这里,我们正在实现Kotlin程序,以对两个数字执行各种算术运算

Given two numbers a and b, we have to find addition, subtraction, multiplication, division, and remainder.

给定两个数字ab ,我们必须找到加法,减法,乘法,除法和余数。

Example:

例:

Input:a = 13b = 5Output:a + b = 18a - b = 8a * b = 65a / b = 2a % b = 3

在Kotlin中执行算术运算的程序 (Program to perform arithmetic operations in Kotlin)

package com.includehelp.basic// Main Method Entry Point of Program fun main(args:Array<String>){val a = 13val b = 5val sum = a + b // Perform Additionval sub = a - b // Perform Subtractionval muti = a * b // Perform Multiplicationval div = a / b // Perform Divisionval rem = a % b // Perform remainder// Print on Consoleprintln("Addison of $a and $b is : $sum")println("Subtraction of $a and $b is : $sub")println("Multiplication of $a and $b is: $muti")println("Division of $a and $b is : $div")println("Remainder of $a and $b is : $rem") }

Output

输出量

Addison of 13 and 5 is : 18 Subtraction of 13 and 5 is : 8 Multiplication of 13 and 5 is: 65 Division of 13 and 5 is : 2 Remainder of 13 and 5 is : 3

翻译自: https://www.includehelp.com/kotlin/perform-arithmetic-operations-on-two-numbers.aspx

kotlin 或 运算

总结

以上是生活随笔为你收集整理的kotlin 或 运算_Kotlin程序对两个数字执行算术运算的全部内容,希望文章能够帮你解决所遇到的问题。

如果觉得生活随笔网站内容还不错,欢迎将生活随笔推荐给好友。