JAVA1

숫자와 연산

수업소개

이 수업에서는 가장 중요한 데이터 타입인 숫자와 문자의 처리 방법을 살펴봅니다. 

 

 

 

강의 1

소스코드

변경사항

public class Number {

    public static void main(String[] args) {
		// Operator
		System.out.println(6 + 2); // 8
		System.out.println(6 - 2); // 4
		System.out.println(6 * 2); // 12
		System.out.println(6 / 2); // 3

		System.out.println(Math.PI); // 3.141592653589793
		System.out.println(Math.floor(Math.PI));
		System.out.println(Math.ceil(Math.PI));
		
		
	}

}

 

 

 

댓글

댓글 본문
  1. 강지민
    수강완료
  2. 민태영
    20240.1.29 완료
  3. 김철흥
    2024.01.19
    완료!
  4. 오늘
    2024.01.11 완료
  5. 집게사장
    2023.11.6 수강완료
  6. 솜사탕
    2023.07.31 완료
  7. 코딩두
    22.07.02 완료
  8. 여유로운쿼카
    2023.06.22
  9. 도학훈
    23.06.20
  10. 김인영
    2023.4.9
  11. 밍구밍구
    연산.. 재밌어용
  12. 당당
    2023.04.06
  13. 완료!!
  14. CODE
    학습완료
  15. Min_is_Here
    2023-02-22
  16. 으앗?
    230221
  17. 태봉이
    20230130
  18. 비전공자의반란
    23-01-09 완
  19. didit
    23.01.06
  20. 자바뿌시기
    22/12/30
  21. 화난 흰둥이
    22.11.28
  22. 요니요니
    감사합니다.11/14/22
  23. 요니요니
    감사합니다.11/14/22
  24. 서우
    221019
  25. 코린이
    22/10/17 완료
  26. 보통사람 박코딩
    할수있다
  27. 후토마끼
    22.10.01
  28. 코딩드림
    22.09.25
  29. 코리니
    912
  30. 가능해
    22.09.07
  31. 빈센트
    2022/8/16 수강 완료
  32. 흥순장
    2022.08.01 완료
  33. economin
    수강완료
  34. happybeom
    7.14
  35. math. :숫자와관련된 도구들모음
  36. Osign
    22.07.01 시청 완료
  37. 디카페인
    22.06.14 완
  38. muaa
    22.05.31 완

    클래스 바로 생성

    math 수학적인 기능모음
    floor 내림
    ceil 올림
  39. 주댕주
    22.05.22_바로 class 로~

    더하기 빼기 나누기 곱하기 할 수 있는거 너무너무 신기하다

    floor --> 소수점 버림
    ceil --> 소수점 올림
  40. 코딩뿌셔본다
    // 자바 프로젝트 우클릭 -> class -> 이름만 지어 넣으면 새로운 파일 작성 땡!
    public class Number {

    public static void main(String[] args) {
    // Operator (=연산자)
    System.out.println(6 + 2); // 8
    System.out.println(6 - 2); // 4
    System.out.println(6 * 2); // 12
    System.out.println(6 / 2); // 3

    System.out.println(Math.PI); // 3.141592653589793
    System.out.println(Math.floor(Math.PI)); // floor는 소숫점을 잘라버리는 문법
    System.out.println(Math.ceil(Math.PI)); // ceil 은 반올림 하는 문법
    }

    }
  41. 2022-05-16
    1-6.3.
    Operator연산자
    +-*/ 사칙연산
    Math. 수학관련 명령어 캐비넷
    Math.PI -> 원주율
    Math.floor 내림
    Math.ceil 올림
    Math.floor(Math.PI) -> 3.0
    Math.ceil(Math.PI) -> 4.0

    댓글참고
    Math.min(1,2) -> 1 두 값 중 더 작은값 출력
    Math.sqrt(4) -> 2 루트값 출력
  42. 낙타
    22/5/12
  43. 육도
    2022.04.24 완료
  44. gutenmorgen
    20220401

    Operator (연산자)에 대한 내용이다.
    단순한 사칙연산뿐만 아니라 Math. 을 이용해 복잡한 계산도 할 수 있다.

    Math.min(x,y)를 사용하면 두 값 중 더 작은 값이 출력된다. (x>y -> y)
    Math.sqrt(x) 를 사용하면 루트 x가 출력된다. ( x=4 -> 2)

    Math.random() *101 을 사용하면 0~100 사이의 랜덤한 수가 출력된다.
    작성법은 int randimNum = (int)(Math.random() * 101);
  45. csongin
    System.out.println(Math.PI);
  46. room9
    22.03.30
  47. 어라랍스타
    2022.03.28 출석이요
  48. 갸나다
    2022.03.21

    //operator
    sysout(Math.PI); // 3.14~
    sysout(Math.floor(Math.PI); // 3.0
    sysout(Math.ceil(Math.PI); // 4
  49. 돌하르방귤
    20220228

    // Operator
    System.out.println(6 + 2); //8
    System.out.println(6 - 2); //4
    System.out.println(6 * 2); //12
    System.out.println(6 / 2); //3

    System.out.println(Math.PI); //3.1415926535897
    System.out.println(Math.floor(Math.PI)); // 3.14에서 소수점을 아예 없애버리는 것
    System.out.println(Math.ceil(Math.PI)); // 3.14의 1을 올림하는 것. 4.0이 됨
  50. 산책자
    220227
버전 관리
egoing
현재 버전
선택 버전
graphittie 자세히 보기