Home » Kotlin » Kotlin programs

# Kotlin basic programs

This section contains **solved basic programs in Kotlin programming language with explanations, outputs**.

## List of the basic programs in Kotlin

- Kotlin program to perform arithmetic operations on two numbers
- Kotlin program to perform simple calculation on two integer numbers
- Kotlin program to input numbers (integer, float, double) at run time
- Kotlin program to input a string
- Kotlin program to find largest of three numbers
- Kotlin program to swap two numbers
- Kotlin program to convert distance Miles to KM and KM to Miles
- Kotlin program to check whether a number is EVEN or ODD
- Kotlin program to check whether given number is positive, negative or zero
- Kotlin program to check leap year
- Kotlin program to print the multiplication table of given number
- Kotlin program to calculate simple interest
- Kotlin program to calculate compound interest
- Kotlin program to calculate and display student grades
- Kotlin program to find GCD/HCF of two numbers
- Kotlin program to convert temperature from Fahrenheit to Celsius
- Kotlin program to find LCM of two numbers
- Kotlin program to find factors of a number
- Kotlin program to check if given number is perfect square
- Kotlin program to find factorial of a number
- Kotlin program to display Fibonacci series
- Kotlin program to count digits in an integer number
- Kotlin program to find sum of digits of a number
- Kotlin program to find area of circle
- Kotlin program to find area of Rectangle
- Kotlin program to find area of Square
- Kotlin program to find area of Triangle
- Kotlin program to find area of a cube
- Kotlin program to find surface area of a cuboid
- Kotlin program to find area of a cylinder
- Kotlin program to find area of Equilateral Triangle
- Kotlin program to find area of Parallelogram
- Kotlin program to find area of Pentagon
- Kotlin program to find surface area of Sphere
- Kotlin program to find volume of Sphere
- Kotlin program to reverse a number
- Kotlin program to print all prime factors of given number
- Kotlin program to check Armstrong number
- Kotlin program to display Armstrong numbers between a range
- Kotlin program to check given number is palindrome number or not
- Kotlin program to print all palindromes in a given range
- Kotlin program to check whether a number is prime or not
- Kotlin program to find prime numbers in a given range
- Kotlin program to check whether number is binary or not
- Kotlin program to convert decimal to binary
- Kotlin program to convert decimal number to octal number
- Kotlin program to convert binary number to octal number
- Kotlin program to convert binary number to decimal number
- Kotlin program to convert octal number to binary number
- Kotlin program to convert octal number to decimal number
- Kotlin program to calculate the sum of natural numbers
- Kotlin program to generate 4 digits OTP
- Kotlin program to print Kotlin, JVM version (printing Java properties)

**Recursion**

- Kotlin program to calculate the power of a number using recursion
- Kotlin program to find sum of natural numbers from 1 to N using recursion
- Kotlin program to find factorial of a given number using recursion
- Kotlin program to find GCD/HCF of two numbers using recursion
- Kotlin program for Decimal to Binary conversion using recursion

TOP Interview Coding Problems/Challenges

- Run-length encoding (find/print frequency of letters in a string)
- Sort an array of 0's, 1's and 2's in linear time complexity
- Checking Anagrams (check whether two string is anagrams or not)
- Relative sorting algorithm
- Finding subarray with given sum
- Find the level in a binary tree with given sum K
- Check whether a Binary Tree is BST (Binary Search Tree) or not
- 1[0]1 Pattern Count
- Capitalize first and last letter of each word in a line
- Print vertical sum of a binary tree
- Print Boundary Sum of a Binary Tree
- Reverse a single linked list
- Greedy Strategy to solve major algorithm problems
- Job sequencing problem
- Root to leaf Path Sum
- Exit Point in a Matrix
- Find length of loop in a linked list
- Toppers of Class
- Print All Nodes that don't have Sibling
- Transform to Sum Tree
- Shortest Source to Destination Path

Comments and Discussions

**Ad:**
Are you a blogger? Join our Blogging forum.