Skip to content

Instantly share code, notes, and snippets.

@riemannulus
Created July 3, 2017 18:41
Show Gist options
  • Save riemannulus/6a658153f80bfd4f8b4f8ff569e01ac0 to your computer and use it in GitHub Desktop.
Save riemannulus/6a658153f80bfd4f8b4f8ff569e01ac0 to your computer and use it in GitHub Desktop.
Pointing a Star - 5
#include <iostream>
/*
역삼각형 모양의 공백을 출력 후 2*n-1 개의 별을 출력하면 되는 문제
*/
using namespace std;
int main()
{
int a, b = 0;
scanf("%d", &a);
while (a--)
{
b++;
for (int i = 0; i < a; i++)
{
printf(" ");
}
for (int i = 0; i < (2 * b) - 1; i++) printf("%c",'*');
printf("\n");
}
return 0;
}
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment