You are viewing a single comment's thread. Return to all comments →
Did it like this in C. Could this get shorter?
int main(){ int n; scanf("%d",&n); int a = n; char space = ' '; char hash = '#'; for(int i = 0; i < n; i++) { for(int j = 0; j < a - 1; j++) { printf("%c", space); } a--; for(int k = 0; k < i + 1; k++) { printf("%c", hash); } printf("\n"); } return 0; }
Seems like cookies are disabled on this browser, please enable them to open this website
Staircase
You are viewing a single comment's thread. Return to all comments →
Did it like this in C. Could this get shorter?