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문, 메서드 中 랜덤 메서드
반응형
'프로그래밍 > C#' 카테고리의 다른 글
c# 2개의 숫자 바꾸는 프로그램 [콘솔] (0) | 2020.07.09 |
---|---|
c# 짝수&홀수 판별 프로그램 [콘솔] (0) | 2020.07.09 |
C# 구구단 프로그램 소스코드 [콘솔] (0) | 2020.07.03 |
c# HtmlAgilityPack 사용법 [콘솔] (1) | 2020.06.01 |
C# 유용한 사이트 모음 (0) | 2020.06.01 |