import java.util.Scanner;
public class Calculator {
public static void main(String[] args) {
Scanner scan=new Scanner(System.in);
System.out.println("1.더하기 2.빼기 3.곱하기4.나누기");
int oper =scan.nextInt();
System.out.print("숫자를 2번 입력하세요");
int a= scan.nextInt();
int b= scan.nextInt();
//System.out.println("oper="+oper);
//System.out.println("a+b= "+(a+b));
/*if문과 swith문 등을 사용해서 구현하세요*/
if(oper==1){
System.out.println("a+b="+(a+b) );
}else if(oper==2){
System.out.println("a-b="+(a-b) );
}else if(oper==3){
System.out.println("a*b="+(a*b) );
}else if(oper==4){
System.out.println("a/b="+(a/b) );
}
}
}
import java.util.Scanner;
public class Calculator {
public static void main(String[] args) {
Scanner scan=new Scanner(System.in);
System.out.println("1.더하기 2.빼기 3.곱하기4.나누기");
int oper =scan.nextInt();
System.out.print("숫자를 2번 입력하세요");
int a= scan.nextInt();
int b= scan.nextInt();
//System.out.println("oper="+oper);
//System.out.println("a+b= "+(a+b));
/*if문과 swith문 등을 사용해서 구현하세요*/
int result=0;
switch(oper){
case 1:result=a+b;
break;
case 2:result=a-b;
break;
case 3:result=a*b;
break;
case 4:result=a/b;
break;
}
System.out.println("결과값 "+result);
/* 내가 한거
* switch(oper){
case 1:
System.out.println("a+b= "+(a+b));
break;
case 2:
System.out.println("a-b= "+(a-b));
break;
default :
System.out.println("a*b= "+(a*b));
}*/
}
}