Kotlin example

Kotlin example for Beginners – Kotlin Program to Display Prime Numbers Between Two Intervals

Hits: 6 Kotlin Program to Display Prime Numbers Between Two Intervals In this program, you’ll learn to display prime numbers between two given intervals, low and high. You’ll learn to do this using a while and a for loop in Kotlin. Example: Display Prime Numbers Between two Intervals fun main(args: Array<String>) { var low = …

Kotlin example for Beginners – Kotlin Program to Display Characters from A to Z using loop

Hits: 0 Kotlin Program to Display Characters from A to Z using loop In this program, you’ll learn to print English alphabets using while loop in Kotlin. You’ll also learn learn to print only uppercased and lowercased alphabets. Example 1: Display Uppercased A to Z fun main(args: Array<String>) { var c: Char c = ‘A’ …

Kotlin example for Beginners – Kotlin Program to Generate Multiplication Table

Hits: 0 Kotlin Program to Generate Multiplication Table In this program, you’ll learn to generate multiplication table of a given number. This is done by using a for and a while loop in Kotlin. You’ll also learn to use ranges to solve the problem. Example 1: Generate Multiplication Table using for loop fun main(args: Array<String>) …

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

Hits: 0 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>) …

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

Hits: 0 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 …

Kotlin example for Beginners – Kotlin Program to Swap Two Numbers

Hits: 2 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 …