JAVA编程,用MAIN主方法编程,求三个小数a.b.c的平均值,a.b.c分别为:double a=5.1 b=20.32 c=32.921
来源:百度知道 编辑:UC知道 时间:2024/09/24 08:33:48
急求
public class test {
public static void main(String[] args) {
double a=5.1,b=20.32,c=32.921; //定义变量
double x=(a+b+c)/3; //定义计算结果变量并计算
System.out.println("三个数的平均值为:"+x); //输出结果
}
}
保存时保存为test.java 选择所有文件
public static void main(string args[])
{
double a,b,c,d;
a=5.1;
b=20.32;
c=32.921;
d=(a+b+c)/3
System.out.print("平均值="+d)
}
public static void main(String [] args)
{
double a=5.1,b=20.32,c=32.921;
System.out.println((a+b+c)/3);
}
那么简单,稍稍学习就可以做出来了!!!
初学java,main方法问题
Java中的主方法public static void main(String args[])为什么要用static来修饰
java编程,计算2007/10/1与2008/1/18之间的天数间隔?要求年,月,日,通过main方法参数传递到程序中
用eclipse编译JAVA,没有找到main
java中main()方法的作用和注意事项
能不能介绍下JAVA中main方法的作用
...........java的main方法的形参名args有什么来历?
请教一个java里的main方法问题
java中new的使用方法,main方法的作用
java编程初级问题Exception in thred "main" java.lang.。。。