using System;
using System.Collections.Generic;
using System.Linq;
using System.Text;
using System.Threading.Tasks;

namespace Study02
{
    class Program
    {
        static void Main(string[] args)
        {
            Console.WriteLine("줄넘기를 몇회 하시겠습니까?(1~5)");
            int repeatNum = Convert.ToInt32(Console.ReadLine());

            if (repeatNum > 0 && repeatNum <= 5)
            {
                for(int i = 0; i < repeatNum; i++)
                {
                    int jump = i + 1;
                    Console.WriteLine("줄넘기를 {0}회 하였습니다.", jump);

                    if (i + 1  == repeatNum)
                    {
                        Console.WriteLine("\n줄넘기를 총 {0}회 하였습니다..", repeatNum);
                    }
                }
            }
            else
            {
                Console.WriteLine("잘못된 수를 입력하였습니다.");
            }   
        }
    }
}

 

'C# > 수업 내용' 카테고리의 다른 글

반복문 별 출력하기  (0) 2023.01.03
반복문 2~9 구구단 출력  (0) 2023.01.03
반복문 1~선택한 수 만큼의 정수의 합 구하기  (0) 2023.01.03
반복문 두 수의 합 구하기  (0) 2023.01.03
반복문 구구단  (0) 2023.01.03

+ Recent posts