Kotlin Control Flow: Exercises, Practice, Solution
Kotlin Control Flow Exercises [ 10 exercises with solution ]
[An editor is available at the bottom of the page to write and execute the scripts. Go to the editor]
1. Write a Kotlin program to check if a given number is positive, negative, or zero.
2. Write a Kotlin program to check if a given number is divisible by 7.
3. Write a Kotlin program to check if a given character is a vowel or a consonant.
4. Write a Kotlin program to print the first 10 natural numbers.
5. Write a Kotlin program to print the Pascal's triangle of a given number of rows.
6. Write a Kotlin program to print the Fibonacci series up to a given number.
7. Write a Kotlin program to calculate the sum of all numbers between two given numbers.
8. Write a Kotlin program to generate the multiplication table of a given number.
9. Write a Kotlin program to count the number of even and odd elements in an array.
10. Write a Kotlin program to find the GCD (Greatest Common Divisor) of two numbers.
More to Come !
* To run the code mouse over on Result panel and click on 'RERUN' button.*
Kotlin Editor:
Do not submit any solution of the above exercises at here, if you want to contribute go to the appropriate exercise page.
It will be nice if you may share this link in any developer community or anywhere else, from where other developers may find this content. Thanks.
https://www.w3resource.com/kotlin-exercises/control-flow/index.php
- Weekly Trends and Language Statistics
- Weekly Trends and Language Statistics