
등차수열
- 1, 3, 5, 7, 9, ... 처럼 연속한 두 항의 차가 일정한 수열
구현
public class ArithmeticSequnce {
public static void main(String[] args) {
int answer = 0;
for(int i = 1; i <= 10; i++) {
if(i % 2 != 0) {
answer += i;
}
}
System.out.println("Answer : " + answer);
}
}
반응형
'Mathematics' 카테고리의 다른 글
[Mathematics] 제수, 피제수, 몫, 나머지 (0) | 2022.07.28 |
---|---|
[Mathematics] 소인수분해(Prime Factorization) (0) | 2022.06.16 |
[Mathematics] 바빌로니아 법(The Babylonian Method) 제곱근 구하기 (0) | 2022.05.30 |
[Mathematics] 조합 (Combination) (0) | 2022.05.27 |
[Mathematics] 순열 (Permutation) (0) | 2022.05.26 |
댓글