조앤의 기술블로그
[프로그래머스] 두 정수 사이의 합(java) 본문
그냥..
class Solution {
public long solution(int a, int b) {
long answer = 0;
if(a > b){
for(int i = b; i <= a; i++){
answer += i;
}
} else if(a < b){
for(int i = a; i <= b; i++){
answer += i;
}
} else if(a == b){
answer = a;
}
return answer;
}
}