Development/C / C++
[C언어 연습문제] 알파벳 피라미드
Komastar.Dev
2014. 6. 4. 14:07
반응형
Windows 7 64bit / Visual Studio 2013 Express 32bit
#include "stdafx.h"
int _tmain(int argc, _TCHAR* argv[])
{
char ch = 'A';
int height = -1;
printf_s("Input Height : ");
scanf_s("%d", &height);
for (int heightCount = 0; heightCount < height; heightCount++)
{
for (int spaceCount = 0; spaceCount < height - heightCount; spaceCount++)
{
printf_s(" ");
}
for (int widthCount = 0; widthCount < heightCount; widthCount++)
{
printf_s("%c ", ch);
ch++;
if (ch > 90)
{
ch = 'A';
}
}
ch = 'A';
printf_s("\n");
}
return 0;
}
Output
반응형