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 = 13
    b = 5

    Output:
    a + b = 18
    a - b = 8
    a * b = 65
    a / b = 2
    a % 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 = 13
    val b = 5

    val sum  = a + b  // Perform Addition
    val sub  = a - b  // Perform Subtraction
    val muti = a * b  // Perform Multiplication
    val div  = a / b  // Perform Division
    val rem  = a % b  // Perform remainder

    // Print  on Console
    println("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 或 运算

评论
添加红包

请填写红包祝福语或标题

红包个数最小为10个

红包金额最低5元

当前余额3.43前往充值 >
需支付:10.00
成就一亿技术人!
领取后你会自动成为博主和红包主的粉丝 规则
hope_wisdom
发出的红包
实付
使用余额支付
点击重新获取
扫码支付
钱包余额 0

抵扣说明:

1.余额是钱包充值的虚拟货币,按照1:1的比例进行支付金额的抵扣。
2.余额无法直接购买下载,可以购买VIP、付费专栏及课程。

余额充值