프로그래머스 Lv 0 기초 문제

a 와 b 출력하기

정수 a와 b가 주어집니다. 각 수를 입력받아 입출력 예와 같은 형식으로 출력하는 코드를 작성해 보세요.

using System;

public class Example
{
	public static void Main()
	{
		String[] s; //입력을 저장한 배열 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 = {1}", b);
		}
}

문자열 반복해서 출력하기

문자열 str 과 정수 n 이 주어진다. str이 n번 반복된 문자열을 만들어 출력하는 코드를 작성하라.

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]);
		
		for(int i = 0; i < a ; i++)
		{
			Console.Write("{0}", s1);
		}

대소문자 바꿔서 출력하기

영어 알파벳으로 이루어진 문자열 str이 주어집니다. 각 알파벳을 대문자는 소문자로 소문자는 대문자로 변환해서 출력하는 코드를 작성해 보세요.

using System;
using System.Linq;
using System.Collections.Generic;
public class Example
{
    public static void Main()
    {
        String s;

        Console.Clear();
        s = Console.ReadLine();
        Example ex = new Example();
        string result = ex.Swap(s);
        Console.WriteLine(result);
    }

    public string Swap(string s) => new string(s.Select(c => char.IsLower(c) ? char.ToUpper(c) : char.ToLower(c)).ToArray());
}

특수문자 출력하기

다음과 같이 출력하도록 작성하라 출력 :

!@#$%^&*(\\'"<>?:;

using System;

public class Example
{
    public static void Main()
    {
      Console.WriteLine(@"!@#$%^&*(\\'""<>?:;");
    }
}

덧셈식 출력하기

두 정수 a, b 가 주어질 때 다은과 같은 형태의 계산식을 출력하는 코드를 작성하시오 a + b = c