Skip to main content

Pattern

/*
To print:
                *   
            *   *   
        *   *   *   
    *   *   *   *   
*   *   *   *   *   

*/


#include <iostream>
using namespace std;

int main(){
     #ifndef ONLINE_JUDGE
        freopen("../asset/input.txt","r",stdin);
        freopen("../asset/output.txt","w",stdout);
    #endif
    // Code here!!
    int n;
    cin>>n;
    
    for(int i=1;i<=n;i++){
        for(int s=0;s<n-i;s++)
            cout<<"\t";
        for(int p =0;p<i;p++)
            cout<<"*\t";
        cout<<endl;
    }
    
    return 0;
}

Comments

Subscribe to Get's Answer by Email