【0628作业】使用for循环,输出加法表

 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 }
原文地址:https://www.cnblogs.com/yanglanlan/p/11110816.html