AmitDiwan has Published 11365 Articles

Kotlin Program to Find LCM of two Numbers

AmitDiwan

AmitDiwan

Updated on 13-Oct-2022 12:42:32

513 Views

In this article, we will understand how to calculate the LCM of two numbers in Kotlin. Lowest Common Multiple (LCM) of two numbers is the smallest positive integer that is evenly divisible by both the numbers. Below is a demonstration of the same Suppose our input is 24 and 18 ... Read More

Kotlin Program to Find GCD of two Numbers

AmitDiwan

AmitDiwan

Updated on 13-Oct-2022 12:39:09

648 Views

In this article, we will understand how to find the GCD of two numbers in Kotlin. Greatest Common Divisor (GCD) of two numbers is the largest number that divides both. Below is a demonstration of the same Suppose our input is Value 1 : 18 Value 2 : 24 ... Read More

Kotlin Program to Add Two Complex numbers

AmitDiwan

AmitDiwan

Updated on 13-Oct-2022 12:37:13

420 Views

In this article, we will understand how to add two complex numbers in Kotlin. They have the ‘I’ that is, an imaginary part associated with it. Below is a demonstration of the same − Suppose our input is 15 +i24 and 3 +i7 The desired output would be 18 ... Read More

Kotlin Program to Multiply Two Floating-Point Numbers

AmitDiwan

AmitDiwan

Updated on 13-Oct-2022 12:34:58

2K+ Views

In this article, we will understand how to multiply two floating-point numbers. A floating-point number, is a positive or negative whole number with a decimal point. There are two types of floating point in Kotlin Float Double Below is a demonstration of the same − Suppose our input ... Read More

Kotlin Program to Read The Number From Standard Input

AmitDiwan

AmitDiwan

Updated on 13-Oct-2022 12:28:31

331 Views

In this article, we will understand how to read a number from standard input in Kotlin. The ‘nextInt’ method is used to read the number. Below is a demonstration of the same Suppose our input is 45 The desired output would be The input value is 45 Algorithm ... Read More

Kotlin Program to Swap Two Numbers

AmitDiwan

AmitDiwan

Updated on 13-Oct-2022 12:26:30

871 Views

In this article, we will understand how to how to swap two numbers in Kotlin. This is done using a temporary variable. Below is a demonstration of the same Suppose our input is val1 : 45 val2 : 60 The desired output would be val1 : 60 val2 : ... Read More

Kotlin Program to Add two Numbers

AmitDiwan

AmitDiwan

Updated on 13-Oct-2022 12:24:26

4K+ Views

In this article, we will understand how to add two numbers. This can be done using the ‘+’ operator. Below is a demonstration of the same Suppose our input is input1 : 10 input2 : 15 The desired output would be Sum : 25 Algorithm Step 1 − ... Read More

Kotlin Program to Print a String

AmitDiwan

AmitDiwan

Updated on 13-Oct-2022 12:22:15

431 Views

In this article, we will understand how to print a string. String is a datatype that contains one or more characters and is enclosed in double quotes(“ ”). Below is a demonstration of the same Suppose our input is − Hello my name is John! The desired output would ... Read More

Kotlin Program to Print an Integer

AmitDiwan

AmitDiwan

Updated on 13-Oct-2022 12:19:29

434 Views

In this article, we will understand how to print an integer. Integer is a primitive data type that contains numbers up to 32 bits. Below is a demonstration of the same − Suppose our input is − 45 The desired output would be − The integer is: 45 ... Read More

Hello World program in Kotlin

AmitDiwan

AmitDiwan

Updated on 13-Oct-2022 12:15:46

370 Views

In this article, we will understand how to print hello world in Kotlin. Hello world is stored as a string format and is printed using ‘print()’ function. Input Suppose our input is Hello World Output The expected out should be Hello World Algorithm Step 1 − START ... Read More

Advertisements