输入样例1:
-1 2
输出样例1:
-1/2=-0.50
输入样例2:
1 -3
输出样例2:
1/(-3)=-0.33
输入样例3:
5 0
输出样例3:
5/0=Error
java
import java.util.*;
class Main{
public static void main(String[] args){
Scanner sc = new Scanner(System.in);
int A = sc.nextInt();
int B = sc.nextInt();
if(B!=0) {
if(B<0){
System.out.print(A+"/"+"("+B+")"+"=");
}else {
System.out.print(A+"/"+B+"=");
}
System.out.printf("%.2f",(double)A/B);
}
else {
System.out.print(A+"/"+B+"=");
System.out.println("Error");
}
}
}