mobile wallpaper 1
mobile wallpaper 2
mobile wallpaper 3
mobile wallpaper 4
mobile wallpaper 5
mobile wallpaper 6
0 자
1 분
scanner와 for를 이용한 구구단 출력
2017-07-12
import java.util.Scanner;
public class Multiplication_For {
public static void main(String[] args) {
int a;
int b;
Scanner firstNum = new Scanner(System.in);
Scanner secondNum = new Scanner(System.in);
System.out.println("구구단 출력입니다 (다음으로 넘어가시려면 Enter를 눌러주세요)");
String 구구단시작 = firstNum.nextLine();
System.out.println("구구단을 시작할 수를 입력해주세요. (예 : 3단 => 3)");
a = firstNum.nextInt();//시작하는 수
System.out.println("구구단이 끝나는 수를 입력해주세요. (예 : 11까지 => 11)");
b = secondNum.nextInt();//끝나는 수
System.out.println();
for(int c = 1; c<= b; c++) {
System.out.println(a+" * "+c+" = "+a*c);
System.out.println();
}
}
}
공유하기

이 글이 도움이 되었다면 더 많은 분들께 공유해 주세요!

scanner와 for를 이용한 구구단 출력
https://nirobase.me/posts/170712-java-scanner-while/
작성자
irostub
게시일
2017-07-12
라이선스
CC BY-NC-SA 4.0

일부 정보가 오래되었을 수 있습니다

목차