C#로또 번호 뽑기 프로그램 [콘솔]

Posted by 슈퍼너드 리보
2020. 7. 3. 17:12 프로그래밍/C#
반응형

콘솔 C# 로또 번호 프로그램

랜덤으로 로또 번호를 출력하는 프로그램을 만들었다.

로또 번호 프로그램 소스코드

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

namespace @enum

{
    class Program
    {
        static void Main(string[] args)
        {
            Random rand = new Random();

            for (int i = 0; i < 6; i++)
            {
                int lottoNum = rand.Next(1, 45); // 0 ~ 45랜덤
                Console.WriteLine(lottoNum);
 
            }
        }
    }
}
 


로또 번호 프로그램 필요개념

열겨형, 데이터형, for문, 메서드 中 랜덤 메서드

반응형