Hits: 1 Kotlin Program to Check Armstrong Number In this program, you’ll learn to check whether a given number is armstrong number or not. You’ll learn to do this by using a while loop in Kotlin. A positive integer is called an Armstrong number of order n if abcd… = an + bn + cn + dn …

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 = …

Hits: 2 Kotlin Program to Check Whether a Number is Prime or Not In this article, you’ll learn to check whether a number is prime or not. This is done using a for-in loop in Kotlin. Example 1: Program to Check Prime Number using a for-in loop fun main(args: Array<String>) { val num = 29 …

Hits: 3 Kotlin Program to Calculate the Power of a Number In this program, you’ll learn to calculate the power of a number with and without using pow() function. Example 1: Calculate power of a number without using pow() fun main(args: Array<String>) { val base = 3 var exponent = 4 var result: Long = …

Hits: 0 Kotlin Program to Calculate the Power of a Number In this program, you’ll learn to calculate the power of a number with and without using pow() function. Example 1: Calculate power of a number without using pow() fun main(args: Array<String>) { val base = 3 var exponent = 4 var result: Long = …

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’ …

Hits: 0 Kotlin Program to Find GCD of two Numbers In this program, you’ll learn to find GCD of two numbers in Kotlin. This is done by using while loop with the help of if else statement. The HCF or GCD of two integers is the largest integer that can exactly divide both numbers (without …

Hits: 0 Kotlin Program to Display Fibonacci Series In this program, you’ll learn to display fibonacci series in Kotlin using for and while loops. You’ll learn to display the series upto a specific term or a number. The Fibonacci series is a series where the next term is the sum of pervious two terms. The …

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>) …

Hits: 0 Kotlin Program to Find Factorial of a Number In this program, you’ll learn to find the factorial of a number using for and while loop in Kotlin. You’ll also learn to use ranges to solve this problem. The factorial of a positive number n is given by: factorial of n (n!) = 1 * 2 …

Hits: 0 Kotlin Program to Calculate the Sum of Natural Numbers In this program, you’ll learn to calculate the sum of natural numbers using for loop and while loop in Kotlin. You’ll also see how ranges can be helpful for solving the problem. The positive numbers 1, 2, 3… are known as natural numbers and …

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>) …

Hits: 0 Kotlin Program to Check Leap Year In this program, you’ll learn to check if the given year is a leap year or not in Kotlin. This is checked using a if else statement and a when statement. A leap year is exactly divisible by 4 except for century years (years ending with 00). …

Hits: 0 Kotlin Program to Find all Roots of a Quadratic Equation In this program, you’ll learn to find all roots of a quadratic equation (depending upon the determinant) and print them using format() in Kotlin. The standard form of a quadratic equation is: ax2 + bx + c = 0, where a, b and …

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 …

Hits: 0 Kotlin Program to Check Whether a Number is Even or Odd In this program, you’ll learn to check if a number entered by an user is even or odd. This will be done using two variants of if…else in Kotlin. Example 1: Check whether a number is even or odd using if…else statement …