Search

for - ๊ตฌ๊ตฌ๋‹จ

import java.util.Scanner; public class Ex13_Gugu { public static void main(String[] args) { // ๊ตฌ๊ตฌ๋‹จ (1~9๋‹จ) // ์›ํ•˜๋Š” ๋‹จ์„ ์ž…๋ ฅ๋ฐ›์•„ ์•„๋ž˜์™€ ๊ฐ™์ด, ๊ตฌ๊ตฌ๋‹จ ์ˆ˜์‹์„ ์ถœ๋ ฅํ•˜์‹œ์˜ค. // ์ž…๋ ฅ : 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 Scanner sc = new Scanner(System.in); System.out.print("์ž…๋ ฅ : "); int input = sc.nextInt(); // 9ํšŒ ๋ฐ˜๋ณต // (์ž…๋ ฅ ๋‹จ) x (๋ฐ˜๋ณต ๋ณ€์ˆ˜:1~9)=๊ฒฐ๊ณผ for (int i = 1; i <= 9; i++) { int result = input * i; System.out.println(input + "x" + i + "=" + result); } sc.close(); } }
Java
๋ณต์‚ฌ