알고리즘 문제 풀이/백준
[백준 27866번/C#] 문자와 문자열
Ardmos :)
2023. 10. 22. 14:45
배운 점:
실수한 점:
using System;
using System.Collections.Generic;
using System.Linq;
namespace ConsoleApp1
{
internal class Program
{
static void Main(string[] args)
{
string strInput = Console.ReadLine();
int i = int.Parse(Console.ReadLine());
// 문제에서 i는 첫 글자를 1로 생각하기 때문에 0부터 시작하는 배열 인덱스에서는 -1 해줘야 맞다
char answer = strInput[i-1];
// 결과 출력
Console.WriteLine(answer);
}
}
}
728x90