Timer is Running

Precise Fomat - Java
Submissions: 28901   Accuracy:


  Difficulty: Easy   Marks: 2

There are times when your answer is a floating point that contains undesired amount of digits after decimal. Here, we'll learn how to get a precise answer out of a floating number. You are given two floating numbers a and b. You need to output a/b and decimal precision of a/b upto 3 places after decimal point.
Note: You may use System.out.format()

Input Format:
First line of input conatins number of testcases T. For each testcase, there will be one line of input containing a and b separated by a space.

Output Format:
For each testcase, print the required output in a new line.

User Task:
Your task is to complete the provided function printInFormat().

1 <= T <= 10
1 <= a, b,<= 100

5.43 2.653

2.04674 2.047

** For More Input/Output Examples Use 'Expected Output' option **

Author: Dhiman Mayank

If you have purchased any course from GeeksforGeeks then please ask your doubt on course discussion forum. You will get quick replies from GFG Moderators there.

Need help with your code? Please use ide.geeksforgeeks.org, generate link and share the link here.

to report an issue on this page.