728x90
package ch01_variable_operator;

public class ArithmeticOperator {
    public static void main(String[] args) {
        int TIME = 4000 ;
        int imsi = TIME ; // 원본 데이터 보존

        int hour ;
        hour = imsi / 3600 ;
        imsi %= 3600 ; // 시(hour) 구한 다음 잔여 데이터

        int minute = imsi / 60 ;
        imsi %= 60 ; // 분(minute) 구한 다음 잔여 데이터

        int second = imsi ; // 나머지 모두를 초(second)에 할당

        System.out.print(TIME + "초는 ") ;
        System.out.print(hour + " 시간, ") ;
        System.out.print(minute + " 분, ") ;
        System.out.println(second + " 초 입니다.") ;
    }
}

cf ) Myjava/ArithmeticOperator.java at master · nolooker/Myjava (github.com)

728x90
반응형

'console.log("What ? " + Cord); > Java' 카테고리의 다른 글

<Git> Casting.java  (0) 2023.02.02
<Git> ArithmeticOperator2.java  (0) 2023.02.02
<Git> Arithmetic01.java  (0) 2023.02.02
<Git> AreaTest.java  (0) 2023.02.02
<Git> add2.java  (0) 2023.02.02
728x90

package ch01_variable_operator;

public class Arithmetic01 {
    public static void main(String[] args) {
        int x = 14 ;
        int y = 5 ;

        System.out.println("더하기 : " + (x + y));
        System.out.println("빼기 : " + (x - y));
        System.out.println("곱하기 : " + (x * y));
        System.out.println("나누기 : " + (x / y));
        System.out.println("나눗셈 : " + (x % y));
    }
}

 

cf) Myjava/Arithmetic01.java at master · nolooker/Myjava (github.com)

728x90
반응형

'console.log("What ? " + Cord); > Java' 카테고리의 다른 글

<Git> ArithmeticOperator2.java  (0) 2023.02.02
<Git> ArithmeticOperator.java  (0) 2023.02.02
<Git> AreaTest.java  (0) 2023.02.02
<Git> add2.java  (0) 2023.02.02
<Git> add.java  (0) 2023.02.02
728x90
package ch01_variable_operator;

public class AreaTest {

    public static void main(String[] args) {

        double radius;
        double area;
        double PI;

        radius = 10.0;
        PI = 3.14;

        area = PI * radius * radius ;

        System.out.print("반지름이" + radius + "일 때");
        System.out.println("\n원의 면적은" + area + "입니다.");

    }
}

cf) Myjava/AreaTest.java at master · nolooker/Myjava (github.com)

728x90
반응형

'console.log("What ? " + Cord); > Java' 카테고리의 다른 글

<Git> ArithmeticOperator.java  (0) 2023.02.02
<Git> Arithmetic01.java  (0) 2023.02.02
<Git> add2.java  (0) 2023.02.02
<Git> add.java  (0) 2023.02.02
Java Programming <덧셈 연산>  (0) 2023.02.02
728x90

package ch01_variable_operator;

public class Add2 {
    public static void main(String[] args) {
        int a, b, c, result ;

        a = 3 ;
        b = 4 ;
        c = 5 ;
        result = 2*a + 3*b - c ;

        System.out.println("a = " + a);
        System.out.println("b = " + b);
        System.out.println("c = " + c);
        System.out.println("result = " + result);

    }
}

 

cf) Myjava/Add2.java at master · nolooker/Myjava (github.com)

728x90
반응형

'console.log("What ? " + Cord); > Java' 카테고리의 다른 글

<Git> Arithmetic01.java  (0) 2023.02.02
<Git> AreaTest.java  (0) 2023.02.02
<Git> add.java  (0) 2023.02.02
Java Programming <덧셈 연산>  (0) 2023.02.02
Java Programming <변수와 연산자>  (0) 2023.02.01
728x90

package ch01_variable_operator;

public class Add {
    public static void main(String[] args) {
        // 변수 선언(정의)
        int x ; // 정수형 데이터를 저장하기 위하여 변수 x를 준비해주세요.
        int y, z ; // 정수가 2개 필요해요.

        // 값을 대입(할당) assign
        // =를 대입 연산자라고 부름
        x = 3 ; // writer
        y = 5 ;
        z = x + y ; // z = 3 + 5

        // +의 2가지 역할) (1) 덧셈 (2) 문자열 결합
        System.out.println(x + " 더하기 " + y + "는(은) " + z + "입니다." );

        x = 4 ; // overwrite
        y = 9 ;
        z = x * y ;

        System.out.println(x + " 곱하기 " + y + "는(은) " + z + "입니다." );

    }
}

 

cf ) Myjava/Add.java at master · nolooker/Myjava (github.com)

728x90
반응형

'console.log("What ? " + Cord); > Java' 카테고리의 다른 글

<Git> Arithmetic01.java  (0) 2023.02.02
<Git> AreaTest.java  (0) 2023.02.02
<Git> add2.java  (0) 2023.02.02
Java Programming <덧셈 연산>  (0) 2023.02.02
Java Programming <변수와 연산자>  (0) 2023.02.01

+ Recent posts

728x90
반응형
728x90
반응형