https://school.programmers.co.kr/learn/courses/30/lessons/120831
using System;
public class Solution {
public int solution(int n) {
int answer = 0;
int i = 0;
while (i<= n)
{
answer += i;
i += 2;
}
return answer;
}
}
'언어공부 > [BAEKJOON] C#' 카테고리의 다른 글
[ 프로그래머스 ] 컨트롤 제트_Lv.0 (0) | 2023.04.15 |
---|---|
[프로그래머스] 등수 매기기_Lv.0 (0) | 2023.03.28 |
[프로그래머스] 중복된 문자 제거_Lv.0 (0) | 2023.03.28 |
[프로그래머스] 7의 개수_Lv.0 (0) | 2023.03.19 |
[프로그래머스] 저주의 숫자 3_Lv.0 (0) | 2023.03.19 |