본문 바로가기
C#/while 반복문

[C#] while 반복문

by bigpicture 2022. 8. 10.
반응형

while 문은 괄호 안의 조건식이 참인 경우 명령문을 실행합니다. 아래와 같이 사용합니다. 

using System;
class HelloWorld {
    static void Main() {
    
    int a=1;
    
    while (a<5)
    {
        Console.WriteLine(a);
        a=a+1;
    }
  }
}

 

반응형

댓글