java 程序调试 怎么改就能运行了啊
packagenewjess;importjava.util.Scanner;publicclassaverage{publicstaticvoidmain(String...
package newjess;
import java.util.Scanner;
public class average {
public static void main(String[] args) {
Scanner in = new Scanner(System.in);
int x = 1;
double num = 0 ;
int dnt = 0 ;
while( x != -1 )
{
num = num + x;
dnt ++;
x = in.nextInt();
}
if( dnt > 0 ){
System.out.println(num/dnt+num+dnt);
}
}
} 展开
import java.util.Scanner;
public class average {
public static void main(String[] args) {
Scanner in = new Scanner(System.in);
int x = 1;
double num = 0 ;
int dnt = 0 ;
while( x != -1 )
{
num = num + x;
dnt ++;
x = in.nextInt();
}
if( dnt > 0 ){
System.out.println(num/dnt+num+dnt);
}
}
} 展开
2个回答
推荐律师服务:
若未解决您的问题,请您详细描述您的问题,通过百度律临进行免费专业咨询