import java.io.*;
public class sum10 {
public static void main(String[] args) {
int s=0;
for(int i=0;i<10;i++){
s=s+InputInt();
}
System.out.println("结果:"+s);
}
public static int InputInt()//自定义的输入整数函数
{int a=0;
System.out.print("请输入一个整数");
try{BufferedReader in1=new BufferedReader(new InputStreamReader(System.in));
a=Integer.parseInt(in1.readLine());
}catch(Exception e){}
return a;}
}
这个程序太简单了吧
随便找本书就搞定啦
你会写hello word的话就应该能搞定
public class Print {
public static void main(String[] args) {
Scanner s = new Scanner (System.in);
int sum = 0;
for (int i = 0; i < 2; i++) {
sum += s.nextInt();
}
System.out.println(sum);
}
}