Search⌘ K
AI Features

Challenge: Formatting Strings

Discover how to format and embed numerical values neatly in Scala strings. This lesson helps you practice controlling decimal precision to display quotients accurately up to three decimal places, improving your string manipulation skills.

Problem Statement

You are given a variable quotient which stores the quotient of two numbers. You have to print the result of the quotient in such a way that the output only shows the quotient up to 3 decimal places.

Input

The input is the variable quotient.

quotient has already been declared for you.

Output

The output will be the formatted quotient embedded in a string.

Sample Input

7 / 3

Sample Output

"The quotient is 2.333"

Test Yourself

Write your code in the given area. Try the exercise by yourself first, but if you get stuck, the solution has been provided. Good luck!

Scala
// Write your code here

Let’s go over the solution review in the next lesson.