Skip to main content

Conclusion: Tasks

In this part of the course, we considered a lot of basic topics, which are already quite a significant factor in the study Kotlin and other languages as well (because, usually, languages do not differ much in this respect, except, of course, for different syntax and idioms).

Before moving on to studying the following topics, I advise you to practice solving some problems that are related to what we have considered this time.

Task #1

Create a simple calculator consisting of the following input: integer, action (a string that can contain +, -, /, *) and another number with a comma. Input example ('>' means new input line):

> 10

> -

> 9.99

0.0099999999999999787

Task #2

Create a program that accepts a number from 1 to 12, which corresponds to the month by its serial number. Print to screen month name and season name.

Task #3

Create a program that will calculate the sum of arithmetic progression (the sum of elements of the range from zero to the entered user values) without loops or recursions.

Task #4

The variable min, the value of which was entered by the user, contains a number from 0 to 59. Determine in which quarter of an hour this number falls (y first, second, third or fourth). Print the result.

Task #5

Create a program that checks for multiples of three all numbers from 1 to 100.

Task #6

Create a program that displays the multiplication table from 1 to 9 using a loop. Hint: you need to make a nested loop (loop within a loop).

Task #7

Create a program where user has to guess a random number between 1 and 100. Limit the number of attempts to 7, and on each failed attempt, answer the user whether the random number is greater or less.

It is very important to practice, so I advise you to do it immediately after reading.