kotlin 或 运算_Kotlin程序对两个数字执行算术运算
生活随笔
收集整理的這篇文章主要介紹了
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.
給定兩個數字a和b ,我們必須找到加法,減法,乘法,除法和余數。
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程序对两个数字执行算术运算的全部內容,希望文章能夠幫你解決所遇到的問題。
- 上一篇: 扣6分多少钱啊?
- 下一篇: 如何使用两个堆栈实现队列_使用两个队列实