package zuoye1;
import java.util.Scanner;
public class 累加 {
public static void main(String[] args) {
// TODO Auto-generated method stub
Scanner sc = new Scanner (System.in);
System.out.print("请输入一个值:");
int j = sc.nextInt();
System.out.println("根据这个值可以输出以下加法表:");
for(int i = 0;i<=j;i++) {
System.out.println(i+" + "+(j-i)+" = "+(j));
}
}
}
输出结果为:0+6=6
1+5=6
2+4=6
3+3=6
4+2=6
5+1=6
6+0=6