importjava.util.Scanner;publicclassTest1{publicstaticvoidmain(String[]args){Scannern=newScanner(System.in);intnum1,num2,num;System.out.println("첫번째 숫자 입력 => ");num1=n.nextInt();System.out.println("두번째 숫자 입력 => ");num2=n.nextInt();System.out.println();if(num1>num2){num=num1;num1=num2;num2=num;}for(inti=num1;i<=num2;i++){System.out.print("*** "+i+"단 *** ");}System.out.println();for(inti=1;i<10;i++){for(intj=num1;j<=num2;j++){System.out.printf("%d * %d = %2d ",j,i,i*j);}System.out.println();}}}
importjava.util.Scanner;publicclassTest1{publicstaticvoidmain(String[]args){Scannern=newScanner(System.in);intnum1,num2,num;System.out.println("첫번째 숫자 입력 => ");num1=n.nextInt();System.out.println("두번째 숫자 입력 => ");num2=n.nextInt();System.out.println();if(num1<num2){min=num1;max=num2;}else{min=num2;max=num1;}for(inti=num1;i<=num2;i++){System.out.print("*** "+i+"단 *** ");}System.out.println();for(inti=1;i<10;i++){for(intj=num1;j<=num2;j++){System.out.printf("%d * %d = %2d ",j,i,i*j);}System.out.println();}}}
importjava.util.Scanner;publicclassMethodGugudan{publicstaticvoidmain(String[]args){Scannerin=newScanner(System.in);intnum1,num2;System.out.println("첫번째 숫자 입력 => ");num1=in.nextInt();System.out.println("두번째 숫자 입력 => ");num2=in.nextInt();System.out.println();gugu(num1,num2);}publicstaticvoidgugu(intnum1,intnum2){intmin,max;if(num1<num2){min=num1;max=num2;}else{min=num2;max=num1;}for(inti=min;i<=max;i++){System.out.print("*** "+i+"단 *** ");}System.out.println();for(inti=1;i<=9;i++){for(intj=min;j<=max;j++){System.out.printf("%d * %d = %2d ",j,i,j*i);}System.out.println();}}}
importjava.util.Scanner;publicclassGugudan2{publicstaticvoidmain(String[]args){intmin,max;intres[]=input_num();min=res[0];max=res[1];for(inti=min;i<=max;i++){System.out.print("*** "+i+"단 *** ");}System.out.println();for(inti=1;i<=9;i++){for(intj=min;j<=max;j++){System.out.printf("%d * %d = %2d ",j,i,j*i);}System.out.println();}}staticint[]input_num(){Scannerin=newScanner(System.in);intnum1,num2;intval[]=newint[2];// 작은 수와 큰 수를 저장할 배열System.out.println("첫번째 숫자 입력 => ");num1=in.nextInt();System.out.println("두번째 숫자 입력 => ");num2=in.nextInt();System.out.println();if(num1<num2){val[0]=num1;val[1]=num2;}else{val[0]=num2;val[1]=num1;}returnval;}}
importjava.util.Scanner;publicclassGugudan2{publicstaticvoidmain(String[]args){intres[]=input_num();//객체가 저장된 주소를 전달받음, 그 주소의 값을 출력for(inti=res[0];i<=res[1];i++){System.out.print("*** "+i+"단 *** ");}System.out.println();for(inti=1;i<=9;i++){for(intj=res[0];j<=res[1];j++){System.out.printf("%d * %d = %2d ",j,i,j*i);}System.out.println();}}staticint[]input_num(){Scannerin=newScanner(System.in);intnum1,num2;intval[]=newint[2];// 작은 수와 큰 수를 저장할 배열System.out.println("첫번째 숫자 입력 => ");num1=in.nextInt();System.out.println("두번째 숫자 입력 => ");num2=in.nextInt();System.out.println();if(num1<num2){val[0]=num1;val[1]=num2;}else{val[0]=num2;val[1]=num1;}returnval;}}
🌞 정보 : 공부 기록용 블로그입니다. 오타나 내용 오류가 있을 경우 알려주시면 감사하겠습니다.
댓글남기기