CODINGTEST/코딩 기초 트레이닝_C#
[프로그래머스/코딩 기초 트레이닝/C#] 4. 대소문자 바꿔서 출력하기 / C#의 String 길이,Char 의 매서드 - 대문자,소문자,기호 판별
bibiana 각선행
2023. 6. 30. 15:06
반응형
오늘도 따뜻한 하루 되세요~ <3

<문제>
< 풀이 >
해당 문제에서는 C#의
String 길이,
Char 의 매서드 - 대문자,소문자,기호 판별
에 대해 알수 있습니다.
- string 길이
string str = "가나다라마바사";
int length = str.Length;
- Char 의 매서드
* 대문자, 소문자, 기호 판별
<채점결과>
<정답 코드>
using System;
public class Example
{
public static void Main()
{
String s;
Console.Clear();
s = Console.ReadLine();
for(int i =0 ; i <s.Length ; i++)
{
if(Char.IsLower(s[i]))
{
Console.Write(char.ToUpper(s[i]));
}
else
{
Console.Write(char.ToLower(s[i]));
}
}
}
}
<문제 출처>
https://school.programmers.co.kr/learn/courses/30/lessons/181949
프로그래머스
코드 중심의 개발자 채용. 스택 기반의 포지션 매칭. 프로그래머스의 개발자 맞춤형 프로필을 등록하고, 나와 기술 궁합이 잘 맞는 기업들을 매칭 받으세요.
programmers.co.kr
반응형