java (a+b)*c=?,赋值ab,给我弄一个输出c答案的代码

2025-01-05 03:57:47
推荐回答(1个)
回答1:

import java.util.Scanner;
public class TestC {
/**
* @param args
*/
public static void main(String[] args) {
// TODO Auto-generated method stub
double a,b,c;
Scanner input = new Scanner(System.in);
System.out.println("please input a and b:");
a =input.nextDouble();
b =input.nextDouble();
c=(a*b)/(a+b);
System.out.println(c);
}
}