Skip to main content

Floyd's Triangle

/* 

To Print Floyd's Triangle
1   
2   3   
4   5   6   
7   8   9   10  
11  12  13  14  15  

*/
#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 ncin>>n;
    int count = 1;
    for(int i=0;i<n;i++){
        for(int j=0;j<=i;j++)
            cout<<count++<<"\t";
        cout<<endl;
    }

    return 0;
}

Comments

Subscribe to Get's Answer by Email