Skip to content

Instantly share code, notes, and snippets.

@ParkMinKyu
Created August 7, 2015 02:45
Show Gist options
  • Star 0 You must be signed in to star a gist
  • Fork 0 You must be signed in to fork a gist
  • Save ParkMinKyu/a3c48d42d45d12bea339 to your computer and use it in GitHub Desktop.
Save ParkMinKyu/a3c48d42d45d12bea339 to your computer and use it in GitHub Desktop.
계산기 완성본
class 계산기{
//값두개를 받는다.(int a, int b)
void 덧셈(int a, int b){
int c = a + b;
System.out.println("a+b=" + c);
}
void 빼기(int a, int b){
//값을 두개 받는다.
//뺀다
//값을 출력한다.
int c = a - b;
System.out.println("a-b=" + c);
}
void 곱하기(int a, int b){
//값을 두개 받는다.
//곱한다.
//값을 출력한다.
int c = a * b;
System.out.println("a*b=" + c);
}
void 나누기(int a, int b){
//값을 두개 받는다.
//나눈다
//값을 출력한다.
int c = a / b;
System.out.println("a/b=" + c);
}
public static void main(String args[]){
계산기 c = new 계산기();
System.out.println("하이");
c.덧셈(1,4);
c.빼기(1,4);
c.곱하기(1,4);
c.나누기(1,4);
}
}
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment