코딩테스트/[C#] 프로그래머스

[프로그래머스 | C# | Lv.0] 대문자와 소문자

냠냠쿠 2023. 9. 17. 21:44
728x90

https://school.programmers.co.kr/learn/courses/30/lessons/120893

📝 나의 풀이

using System;

public class Solution {
    public string solution(string my_string) {
        string answer = "";
        
        for(int i=0; i<my_string.Length; i++){
            if(Char.IsLower(my_string[i])==true){
                answer += Char.ToUpper(my_string[i]);
            } else {
                answer += Char.ToLower(my_string[i]);
            }
        }
        return answer;
    }
}
728x90