FTN-Numbers

Report a typo

Write a program that reads an integer number and prints one of the letters below:

  • F if the number is 0, 1, 2, 3, 5, 8, 13, 21, 34, 55 (the Fibonacci numbers)
  • T if the number is 0, 1, 3, 6, 10, 15, 21, 28, 36, 45 (the Triangle numbers)
  • P if is the power of 10: 1, 10, 100, 1000, 10000, 100000
  • N if otherwise.

Follow the order. You do not need to consider other numbers (as 89 is a Fibonacci number, but the program must print N because it does not belong to the given subsequence).

Sample Input 1:

1

Sample Output 1:

F

Sample Input 2:

15

Sample Output 2:

T

Sample Input 3:

89

Sample Output 3:

N
Write a program in Kotlin
fun main() {
// put your code here
}
___

Create a free account to access the full topic