• Source
    1. #include <iostream>
    2. using namespace std;
    3. char a[102][102];
    4. int main()
    5. {
    6. int n;
    7. cin>>n;
    8. for(int i = 0; i < n; ++i){
    9. for(int j = 0; j < n; ++j){
    10. if( j >= n - i - 1){
    11. a[i][j] = '#';
    12. }
    13. else{
    14. a[i][j] = ' ';
    15. }
    16. }
    17. }
    18. for( int i = 0 ; i < n; ++i){
    19. for(int j = 0; j < n; ++j){
    20. cout<<a[i][j];
    21. }
    22. cout<<endl;
    23. }
    24. // your code goes here
    25. return 0;
    26. }