Kotlin tutorials

Kotlin example for Beginners – Kotlin Program to Check Whether a Character is Alphabet or Not

Kotlin Program to Check Whether a Character is Alphabet or Not In this program, you’ll learn to check whether a given character is an alphabet or not. This is done using an if else statement or when expression in Kotlin. Example 1: Kotlin Program to Check Alphabet using if else fun main(args: Array<String>) { val …

Kotlin example for Beginners – Kotlin Program to Check Whether an Alphabet is Vowel or Consonant

Kotlin Program to Check Whether an Alphabet is Vowel or Consonant In this program, you’ll learn to check whether an alphabet is a vowel or a consotant using if..else and when statement in Kotlin. Example 1: Check whether an alphabet is vowel or consonant using if..else statement fun main(args: Array<String>) { val ch = ‘i’ …

Kotlin example for Beginners – Kotlin Program to Swap Two Numbers

Kotlin Program to Swap Two Numbers In this program, you’ll learn two techniques to swap two numbers in Kotlin. The first one uses a temporary variable for swapping, while the second one doesn’t use any temporary variables. Example 1: Swap two numbers using temporary variable fun main(args: Array<String>) { var first = 1.20f var second …

Kotlin example for Beginners – Kotlin Program to Compute Quotient and Remainder

Kotlin Program to Compute Quotient and Remainder In this program, you’ll learn to compute quotient and remainder from the given dividend and divisor in Kotlin. Example: Compute Quotient and Remainder fun main(args: Array<String>) { val dividend = 25 val divisor = 4 val quotient = dividend / divisor val remainder = dividend % divisor println(“Quotient …

Kotlin example for Beginners – Kotlin Program to Find ASCII value of a character

Kotlin Program to Find ASCII value of a character In this program, you’ll learn to find and display the ASCII value of a character in Kotlin. This is done using type-casting and normal variable assignment operations. Example: Find ASCII value of a character fun main(args: Array) { val c = ‘a’ val ascii = c.toInt() …

Kotlin example for Beginners – Kotlin Program to Multiply two Floating Point Numbers

Kotlin Program to Multiply two Floating Point Numbers In this program, you’ll learn to multiply two floating point numbers in Kotlin, store the result and display it on the screen. Example: Multiply Two Floating Point Numbers fun main(args: Array<String>) { val first = 1.5f val second = 2.0f val product = first * second println(“The …