The best way to learn Kotlin is by practicing examples. The page contains examples on basic concepts of Kotlin. You are advised to take the references from these examples and try them on your own.

All the programs on this page are tested and should work on all platforms.

  1. Kotlin Program to Print an Integer (Entered by the User)
  2. Kotlin Program to Add Two Integers
  3. Kotlin Program to Multiply two Floating Point Numbers
  4. Kotlin Program to Find ASCII value of a character
  5. Kotlin Program to Compute Quotient and Remainder
  6. Kotlin Program to Swap Two Numbers
  7. Kotlin Program to Check Whether a Number is Even or Odd
  8. Kotlin Program to Check Whether an Alphabet is Vowel or Consonant
  9. Kotlin Program to Find the Largest Among Three Numbers
  10. Kotlin Program to Find all Roots of a Quadratic Equation
  11. Kotlin Program to Check Leap Year
  12. Kotlin Program to Check Whether a Number is Positive or Negative
  13. Kotlin Program to Check Whether a Character is Alphabet or Not
  14. Kotlin Program to Calculate the Sum of Natural Numbers
  15. Kotlin Program to Find Factorial of a Number
  16. Kotlin Program to Generate Multiplication Table
  17. Kotlin Program to Display Fibonacci Series
  18. Kotlin Program to Find GCD of two Numbers
  19. Kotlin Program to Find LCM of two Numbers
  20. Kotlin Program to Display Characters from A to Z using loop
  21. Kotlin Program to Count Number of Digits in an Integer
  22. Kotlin Program to Reverse a Number
  23. Kotlin Program to Calculate the Power of a Number
  24. Kotlin Program to Check Whether a Number is Palindrome or Not
  25. Kotlin Program to Check Whether a Number is Prime or Not
  26. Kotlin Program to Display Prime Numbers Between Two Intervals
  27. Kotlin Program to Check Armstrong Number
  28. Kotlin Program to Display Armstrong Number Between Two Intervals
  29. Kotlin Program to Display Prime Numbers Between Intervals Using Function
  30. Kotlin Program to Display Armstrong Numbers Between Intervals Using Function
  31. Kotlin Program to Display Factors of a Number
  32. Kotlin Program to Make a Simple Calculator Using switch...case
  33. Kotlin Program to Check Whether a Number can be Expressed as Sum of Two Prime Numbers
  34. Kotlin Program to Find the Sum of Natural Numbers using Recursion
  35. Kotlin Program to Find Factorial of a Number Using Recursion
  36. Kotlin Program to Find G.C.D Using Recursion
  37. Kotlin Program to Convert Binary Number to Decimal and vice-versa
  38. Kotlin Program to Convert Octal Number to Decimal and vice-versa
  39. Kotlin Program to Convert Binary Number to Octal and vice-versa
  40. Kotlin Program to Reverse a Sentence Using Recursion
  41. Kotlin Program to calculate the power using recursion
  42. Kotlin Program to Calculate Average Using Arrays
  43. Kotlin Program to Find Largest Element in an Array
  44. Kotlin Program to Calculate Standard Deviation
  45. Kotlin Program to Add Two Matrix Using Multi-dimensional Arrays
  46. Kotlin Program to Multiply to Matrix Using Multi-dimensional Arrays
  47. Kotlin Program to Multiply two Matrices by Passing Matrix to a Function
  48. Kotlin Program to Find Transpose of a Matrix
  49. Kotlin Program to Find the Frequency of Character in a String
  50. Kotlin Program to Count the Number of Vowels and Consonants in a Sentence
  51. Kotlin Program to Sort Elements in Lexicographical Order (Dictionary Order)
  52. Kotlin Program to Add Two Complex Numbers by Passing Class to a Function
  53. Kotlin Program to Calculate Difference Between Two Time Periods
  54. Kotlin Code To Create Pyramid and Pattern
  55. Kotlin Program to Remove All Whitespaces from a String
  56. Kotlin Program to Print an Array
  57. Kotlin Program to Convert String to Date
  58. Kotlin Program to Round a Number to n Decimal Places
  59. Kotlin Program to Concatenate Two Arrays
  60. Kotlin Program to Convert Character to String and Vice-Versa
  61. Kotlin Program to Check if An Array Contains a Given Value
  62. Kotlin Program to Get Current Date/TIme
  63. Kotlin Program to Convert Milliseconds to Minutes and Seconds
  64. Kotlin Program to Add Two Dates
  65. Kotlin Program to Join Two Lists
  66. Kotlin Program to Convert List (ArrayList) to Array and Vice-Versa
  67. Kotlin Program to Get Current Working Directory
  68. Kotlin Program to Convert Map (HashMap) to List
  69. Kotlin Program to Convert Array to Set (HashSet) and Vice-Versa
  70. Kotlin Program to Convert Byte Array to Hexadecimal
  71. Kotlin Program to Create String from Contents of a File
  72. Kotlin Program to Append Text to an Existing File
  73. Kotlin Program to Convert a Stack Trace to a String
  74. Kotlin Program to Convert File to byte array and Vice-Versa
  75. Kotlin Program to Convert InputStream to String
  76. Kotlin Program to Convert OutputStream to String
  77. Kotlin Program to Lookup enum by String value
  78. Kotlin Program to Compare Strings
  79. Kotlin Program to Sort a Map By Values
  80. Kotlin Program to Sort ArrayList of Custom Objects By Property
  81. Kotlin Program to Check if a String is Numeric