C#
-
문제 설명 문자열 str이 주어집니다. 문자열을 시계방향으로 90도 돌려서 아래 입출력 예와 같이 출력하는 코드를 작성해 보세요. 제한사항 1 ≤ str의 길이 ≤ 10 Solution.cs using System; public class Example { public static void Main() { String s; Console.Clear(); s = Console.ReadLine(); for (int i = 0; i < s.Length; i++) { Console.WriteLine(s[i]); } } } 실행 결과 테스트 1 입력값 〉 "abcde" 기댓값 〉 "a b c d e" 실행 결과 〉 테스트를 통과하였습니다. 출력 〉 a b c d e
[C# 코딩테스트 연습] LV.0 문자열 돌리기문제 설명 문자열 str이 주어집니다. 문자열을 시계방향으로 90도 돌려서 아래 입출력 예와 같이 출력하는 코드를 작성해 보세요. 제한사항 1 ≤ str의 길이 ≤ 10 Solution.cs using System; public class Example { public static void Main() { String s; Console.Clear(); s = Console.ReadLine(); for (int i = 0; i < s.Length; i++) { Console.WriteLine(s[i]); } } } 실행 결과 테스트 1 입력값 〉 "abcde" 기댓값 〉 "a b c d e" 실행 결과 〉 테스트를 통과하였습니다. 출력 〉 a b c d e
2023.10.07 -
문제 설명 두 개의 문자열 str1, str2가 공백으로 구분되어 입력으로 주어집니다. 입출력 예와 같이 str1과 str2을 이어서 출력하는 코드를 작성해 보세요. 제한사항 1 ≤ str1, str2의 길이 ≤ 10 Solution.cs using System; public class Example { public static void Main() { String[] input; Console.Clear(); input = Console.ReadLine().Split(' '); String s1 = input[0]; String s2 = input[1]; String result = s1 + s2; Console.WriteLine(result.Replace(" ", String.Empty)); } } ..
[C# 코딩테스트 연습] LV.0 문자열 붙여서 출력하기문제 설명 두 개의 문자열 str1, str2가 공백으로 구분되어 입력으로 주어집니다. 입출력 예와 같이 str1과 str2을 이어서 출력하는 코드를 작성해 보세요. 제한사항 1 ≤ str1, str2의 길이 ≤ 10 Solution.cs using System; public class Example { public static void Main() { String[] input; Console.Clear(); input = Console.ReadLine().Split(' '); String s1 = input[0]; String s2 = input[1]; String result = s1 + s2; Console.WriteLine(result.Replace(" ", String.Empty)); } } ..
2023.10.07 -
문제 설명 두 정수 a, b가 주어질 때 다음과 같은 형태의 계산식을 출력하는 코드를 작성해 보세요. a + b = c 제한사항 1 ≤ a, b ≤ 100 Solution.cs using System; public class Example { public static void Main() { String[] s; Console.Clear(); s = Console.ReadLine().Split(' '); int a = Int32.Parse(s[0]); int b = Int32.Parse(s[1]); Console.WriteLine("{0} + {1} = {2}", a, b, a + b); } } 실행 결과 테스트 1 입력값 〉 "4 5" 기댓값 〉 "4 + 5 = 9" 실행 결과 〉 테스트를 통과하였습니..
[C# 코딩테스트 연습] LV.0 덧셈식 출력하기문제 설명 두 정수 a, b가 주어질 때 다음과 같은 형태의 계산식을 출력하는 코드를 작성해 보세요. a + b = c 제한사항 1 ≤ a, b ≤ 100 Solution.cs using System; public class Example { public static void Main() { String[] s; Console.Clear(); s = Console.ReadLine().Split(' '); int a = Int32.Parse(s[0]); int b = Int32.Parse(s[1]); Console.WriteLine("{0} + {1} = {2}", a, b, a + b); } } 실행 결과 테스트 1 입력값 〉 "4 5" 기댓값 〉 "4 + 5 = 9" 실행 결과 〉 테스트를 통과하였습니..
2023.10.07 -
문제 설명 다음과 같이 출력하도록 코드를 작성해 주세요. 출력 예시 !@#$%^&*(\'"?:; Solution.cs using System; public class Example { public static void Main() { Console.WriteLine("!@#$%^&*(\\'\"?:;"); } } 실행 결과 테스트 1 입력값 〉 "이 문제는 입력이 없습니다." 기댓값 〉 "!@#$%^&*(\'"?:;" 실행 결과 〉 테스트를 통과하였습니다. 출력 〉 !@#$%^&*(\'"?:;
[C# 코딩테스트 연습] LV.0 특수문자 출력하기문제 설명 다음과 같이 출력하도록 코드를 작성해 주세요. 출력 예시 !@#$%^&*(\'"?:; Solution.cs using System; public class Example { public static void Main() { Console.WriteLine("!@#$%^&*(\\'\"?:;"); } } 실행 결과 테스트 1 입력값 〉 "이 문제는 입력이 없습니다." 기댓값 〉 "!@#$%^&*(\'"?:;" 실행 결과 〉 테스트를 통과하였습니다. 출력 〉 !@#$%^&*(\'"?:;
2023.10.07 -
문제 설명 영어 알파벳으로 이루어진 문자열 str이 주어집니다. 각 알파벳을 대문자는 소문자로 소문자는 대문자로 변환해서 출력하는 코드를 작성해 보세요. 제한사항 1 ≤ str의 길이 ≤ 20 str은 알파벳으로 이루어진 문자열입니다. Solution.cs using System; public class Example { public static void Main() { String s; Console.Clear(); s = Console.ReadLine(); String result = ""; foreach (char c in s) { if (char.IsLower(c)) { result += char.ToUpper(c); } else if (char.IsUpper(c)) { result += char..
[C# 코딩테스트 연습] LV.0 대소문자 바꿔서 출력하기문제 설명 영어 알파벳으로 이루어진 문자열 str이 주어집니다. 각 알파벳을 대문자는 소문자로 소문자는 대문자로 변환해서 출력하는 코드를 작성해 보세요. 제한사항 1 ≤ str의 길이 ≤ 20 str은 알파벳으로 이루어진 문자열입니다. Solution.cs using System; public class Example { public static void Main() { String s; Console.Clear(); s = Console.ReadLine(); String result = ""; foreach (char c in s) { if (char.IsLower(c)) { result += char.ToUpper(c); } else if (char.IsUpper(c)) { result += char..
2023.10.07 -
문제 설명 문자열 str과 정수 n이 주어집니다. str이 n번 반복된 문자열을 만들어 출력하는 코드를 작성해 보세요. 제한사항 1 ≤ str의 길이 ≤ 10 1 ≤ n ≤ 5 Solution.cs using System; public class Example { public static void Main() { String[] input; Console.Clear(); input = Console.ReadLine().Split(' '); String s1 = input[0]; int a = Int32.Parse(input[1]); String result = ""; for (int i = 0; i < a; i++) { result += s1; } Console.WriteLine(result); } } ..
[C# 코딩테스트 연습] LV.0 문자열 반복해서 출력하기문제 설명 문자열 str과 정수 n이 주어집니다. str이 n번 반복된 문자열을 만들어 출력하는 코드를 작성해 보세요. 제한사항 1 ≤ str의 길이 ≤ 10 1 ≤ n ≤ 5 Solution.cs using System; public class Example { public static void Main() { String[] input; Console.Clear(); input = Console.ReadLine().Split(' '); String s1 = input[0]; int a = Int32.Parse(input[1]); String result = ""; for (int i = 0; i < a; i++) { result += s1; } Console.WriteLine(result); } } ..
2023.10.06 -
문제 설명 정수 num1, num2가 매개변수 주어집니다. num1과 num2를 곱한 값을 return 하도록 solution 함수를 완성해주세요. 제한사항 0 ≤ num1 ≤ 100 0 ≤ num2 ≤ 100 Solution.cs using System; public class Solution { public int solution(int num1, int num2) { int answer = num1 * num2; return answer; } } 실행 결과 테스트 1 입력값 〉 3, 4 기댓값 〉 12 실행 결과 〉 테스트를 통과하였습니다. 테스트 2 입력값 〉 27, 19 기댓값 〉 513 실행 결과 〉 테스트를 통과하였습니다.
[C# 코딩테스트 연습] Lv.0 두 수의 곱문제 설명 정수 num1, num2가 매개변수 주어집니다. num1과 num2를 곱한 값을 return 하도록 solution 함수를 완성해주세요. 제한사항 0 ≤ num1 ≤ 100 0 ≤ num2 ≤ 100 Solution.cs using System; public class Solution { public int solution(int num1, int num2) { int answer = num1 * num2; return answer; } } 실행 결과 테스트 1 입력값 〉 3, 4 기댓값 〉 12 실행 결과 〉 테스트를 통과하였습니다. 테스트 2 입력값 〉 27, 19 기댓값 〉 513 실행 결과 〉 테스트를 통과하였습니다.
2023.10.04 -
문제 설명 정수 a와 b가 주어집니다. 각 수를 입력받아 입출력 예와 같은 형식으로 출력하는 코드를 작성해 보세요. 제한사항 -100,000 ≤ a, b ≤ 100,000 Solution.cs using System; public class Example { public static void Main() { String[] s; Console.Clear(); s = Console.ReadLine().Split(' '); int a = Int32.Parse(s[0]); int b = Int32.Parse(s[1]); Console.WriteLine("a = {0}", a); Console.WriteLine("b = {0}", b); } } 실행 결과 입력값 〉 "4 5" 기댓값 〉 "a = 4 b = 5"..
[C# 코딩테스트 연습] LV.0 a와 b 출력하기문제 설명 정수 a와 b가 주어집니다. 각 수를 입력받아 입출력 예와 같은 형식으로 출력하는 코드를 작성해 보세요. 제한사항 -100,000 ≤ a, b ≤ 100,000 Solution.cs using System; public class Example { public static void Main() { String[] s; Console.Clear(); s = Console.ReadLine().Split(' '); int a = Int32.Parse(s[0]); int b = Int32.Parse(s[1]); Console.WriteLine("a = {0}", a); Console.WriteLine("b = {0}", b); } } 실행 결과 입력값 〉 "4 5" 기댓값 〉 "a = 4 b = 5"..
2023.10.02