l
import java.io.*; public class kuga { public static void main(String args[]) throws Exception { int i,j,k,l; int ku[][] = new int[10][9]; for (i= 1 ; [ a ] ; i++) { ku[i][0] = i; for (j = 2 ; [ b ] ; j++) { k = j-1; ku[i][k] = [ c ]; } } BufferedReader in = new BufferedReader(new InputStreamReader(System.in)); System.out.print("1から9までの中で好きな数字を入力して下さい =>"); String s = new String(in.readLine()); int m = Integer.parseInt( s ); if ( m >= 1 & m <= 9 ) { System.out.println(m + " の段のかけ算を表示します。"); for (l = 0; l < 9 ; l++) System.out.println( m + " * " + (l+1) + " = " + ku[m][l] + " "); } else System.out.println("ちゃんと入力して下さい。"); } }
a = i < 10 b = j < 10 c = i*j |
4 の段のかけ算を表示します。 4 * 1 = 4 4 * 2 = 8 4 * 3 = 12 4 * 4 = 16 4 * 5 = 20 4 * 6 = 24 4 * 7 = 28 4 * 8 = 32 4 * 9 = 36 |
#include |