일 | 월 | 화 | 수 | 목 | 금 | 토 |
---|---|---|---|---|---|---|
1 | 2 | 3 | ||||
4 | 5 | 6 | 7 | 8 | 9 | 10 |
11 | 12 | 13 | 14 | 15 | 16 | 17 |
18 | 19 | 20 | 21 | 22 | 23 | 24 |
25 | 26 | 27 | 28 | 29 | 30 | 31 |
- https://subicura.com/2017/01/19/docker-guide-for-beginners-1.html
- https://siyoon210.tistory.com/130
- https://aws.amazon.com/ko/docker/
- https://appmaster.io/ko/blog/rest-apiran-mueosimyeo-dareun-yuhyeonggwa-eoddeohge-dareungayo
- https://jcon.tistory.com/189
- https://sewonzzang.tistory.com/22
- https://joshua1988.github.io/web-development/javascript/promise-for-beginners/
- https://hi-zini.tistory.com/entry/%EB%B9%84%EB%8F%99%EA%B8%B0%EC%A0%81-%EB%B0%A9%EC%8B%9D-%EC%B2%98%EB%A6%AC-%EB%B0%A9%EB%B2%95-Callback-Promise-async-await
- https://goodgid.github.io/HTTP-Communicate-Process/
- https://joshua1988.github.io/web-development/javascript/js-async-await/
- Today
- Total
“Connecting the dots”
JAVA 알고리즘 연습문제 본문
//팩토리얼 구하기 :4! =4*3*2*1
public static double factorial(int n) {
int result = 1;
for (int i = n; i >= 1; i--)
{
result *= i;
}
return result;
}
반복문을 1부터 정수 N 까지의 정수를 곱하는 값을 계산하고 최종적으로 값을 반환합니다 result 변수에 초
기값을 1로 설정해주고 반복문에서 i 변수의 값을 1 감소 시키면서 변수 result 에 곱해준다
//배수의 합
// int result = MyMath.hap(10,3):=>0+3+6+9
// int result = MyMath.hap(10,4):=>0+4+8
public static int hap(int n,int baesu) {
int sum = 0;
for (int i = baesu; i < n; i += baesu) {
sum += i;
}
return sum;
}
배수 에서 시작으로 n 이전까지 의 배수를 구해 sum 변수에 더해준다
//누적승 구하기: n s m승 구하기
//result = MyMath.pow(2,3); => 2*2*2
public static double pow(double n,int m) {
double result = 1;
for (int i = 0; i < m; i++) {
result *= n;
}
return result;
}
result 변수를 1로 초기화한후 m번 반복하면서 n을 result에 곱해준다
'JAVA' 카테고리의 다른 글
JAVAStuDY Stack Heap (0) | 2023.04.11 |
---|---|
JAVA 배열 (0) | 2023.04.11 |
java study 메소드 정의 (0) | 2023.04.10 |
java study (0) | 2023.04.10 |
JAVA Study 자바로 구현된 구구단 프로그램구현. (0) | 2023.04.07 |