[프로그래머스] 두 정수 사이의 합😥

GoGoDev·2021년 6월 17일
0

Programmers Lv.1🌱

목록 보기
36/46

https://programmers.co.kr/learn/courses/30/lessons/12912

등차수열의 합
sum = (∣ a − b ∣ + 2) * (a + b) / 2

function solution(a, b) {
    if(a === b)
        return a;
    var sum = (Math.abs(a-b)+1)*(a+b)/2
    return sum;
}
profile
🐣차근차근 무럭무럭🐣

0개의 댓글