We read every piece of feedback, and take your input very seriously.
To see all available qualifiers, see our documentation.
There was an error while loading. Please reload this page.
1 parent 3d12077 commit 56101e1Copy full SHA for 56101e1
DailyCodingProblem/src/Easy/PreciseFormat.java
@@ -0,0 +1,28 @@
1
+package Easy;
2
+
3
+import java.util.Scanner;
4
5
+public class PreciseFormat {
6
7
+ public static void printInFormat(float a, float b) {
8
9
+ if(b!=0) {
10
11
+ float result=a/b;
12
+ System.out.format("%.7f ", result);
13
+ System.out.format("%.3f%n", result);
14
+ }
15
16
17
+ public static void main(String[] args) {
18
+ // TODO Auto-generated method stub
19
+ Scanner sc=new Scanner(System.in);
20
+ System.out.print("Please Enter Float value of a: ");
21
+ float a=sc.nextFloat();
22
+ System.out.print("Please Enter Float value of b: ");
23
+ float b=sc.nextFloat();
24
25
+ printInFormat(a,b);
26
27
28
+}
0 commit comments