본문 바로가기

Programming/C Programming

C(C언어) 반복문을 이용하여 알파벳 출력하기

/******************************************
********반복문을 이용하여, 알파벳을********
*******순서대로 출력하는 C프로그래밍*******
*******************************************
***********작성자 : 전 영 호***************
******************************************/
 

#include<stdio.h>
#include<stdlib.h>

int main(){
 char letter='A';           //문자 출력을 위한 변수
 
 while(true){                //반복문
  printf("%c", letter);    //현재 문자 출력
  letter = letter+1;         //letter에 현재 문자에서 +1된 문자로 재 저장 (ex. B = A+1)
  if(letter>'Z') break;   //Z보다 큰 값이면 반복문 종료
 }
 puts("");                  // 개행
 system("Pause");
 return 0;
}