Course of Raku / Essentials / Data type conversion / Exercises
Fractional part
Problem
You are given a number, which is hard-coded in the program. Print its fractional part. Here is the beginning of the program:
my $n = 15.8972;
# ... Your code here
Example
The program must print the part of the number after the decimal point:
$ raku fractional-part.raku
0.8972
Solution
Course navigation
←
Loops
/ Postfix form of for
|
Typed variables
→
Translations of this page: English • Deutsch • Español • Italiano • Latviešu • Nederlands • Български • Русский • Українська