1 package com.workprojects; 2 3 /** 4 * 输出加法表 5 * 2019-0628 6 * @author L 7 * 8 */ 9 import java.util.Scanner; 10 11 public class Work062801 { 12 static Scanner sc = new Scanner(System.in); 13 14 public static void main(String[] args) { 15 System.out.print("请输入一个值:"); 16 int num = sc.nextInt(); 17 System.out.println("根据这个值可以输出以下加法表:"); 18 for (int i = 0; i <= num; i++) { 19 System.out.println(i + " + " + (num - i) + " = " + num); 20 } 21 } 22 }