프로그래머스
프로그래머스 - 두 정수 사이의 합
thiago6
2019. 1. 5. 14:18
class Solution {
public long solution(int a, int b) {
long answer = 0;
int tmp;
if (a > b) {
tmp = a;
a = b;
b = tmp;
}
while (a <= b) {
answer += a;
a++;
}
return answer;
}
}