Kotlin program to calculate simple interest with user input values

Calculate simple interest in Kotlin: In this kotlin programming tutorial, we will learn how to calculate simple interest by using the user provided values. The user will enter the values and the program will calculate the simple interest.   Algorithm : Our program will use the below algorithm : Create Read more…

Kotlin program to check if a string contains another substring

Introduction : In this kotlin programming tutorial, we will learn how to check if a substring exists in another string or not. The program will take the strings as input from the user and print out the result. We will learn how to check if the string contains a substring Read more…

Kotlin program to find out the largest among three numbers

Introduction : In this Kotlin programming tutorial, we will learn how to find out the largest number among the three. The user will enter the number values, our program will find and print out the result. To compare three numbers and finding out the largest one, we can either implement Read more…

Kotlin program to access a character in a string by index

Introduction : This kotlin program is to show you how we can access a character in a string using index position. The program will take one string as input from the user. Next, it will take the index position. The output of the program will be the character at that Read more…

Kotlin program to print each character of a string (4 different ways)

Introduction : In this kotlin programming tutorial, we will learn how to print each character of a string in kotlin. The program will take the string as input from the user and print out all characters of it one by one. We will iterate through each character of a string Read more…

Kotlin program to reverse a string recursively

Introduction : In this kotlin programming tutorial, we will learn how to reverse a string recursively in kotlin. The program will take the string from the user and reverse it. We will use one separate method and call it recursively to reverse the string. Algorithm : The algorithm we are Read more…

How to check if a number is positive, negative or zero in Kotlin

Introduction : In this Kotlin programming tutorial, we will learn how to check if a number is positive, negative or zero in Kotlin. We will implement this program with a when block. The program will ask the user to enter a number. It will read the number, find out if Read more…

How to convert a string to Date in Kotlin

Convert a string to a Date in Kotlin : In this tutorial, we will learn how to convert a string to a date in Kotlin. We will use java.util.LocalDate class to convert a string to a Date. java.util.LocalDate : LocalDate represents a Date in ISO-8601 calendar system. Note that it Read more…

How to read user input in Kotlin

How to take input from user in Kotlin : In this tutorial, we will learn how to take user input in Kotlin with different examples. Reading user input in Kotlin is easy. Kotlin provides one inbuilt function to make this task easy for us. readLine() function allow us to read Read more…

Safe call operator in Kotlin with example

Safe call operator in Kotlin : Safe call operator is denoted by ? in Kotlin. This operator is mainly used to remove null pointer exception or NPE in Kotlin. In this tutorial, we will learn how to use safe call operator in Kotlin with different use cases. A simple example Read more…