fork download
  1. #include <iostream>
  2. using namespace std;
  3.  
  4. int main() {
  5. int rows;
  6. cin>>rows;
  7. cout<<"Floyd's Triangle of rows "<<rows<<endl;
  8.  
  9. //Main logic to print Floyd's triangle
  10. int count=1;
  11. for(int i=0; i<rows; i++){
  12. for(int j=0; j<=i; j++){
  13. cout<< (count++) << " ";
  14. }
  15. cout<<endl;
  16. }
  17. return 0;
  18. }
Success #stdin #stdout 0.01s 5280KB
stdin
5
stdout
Floyd's Triangle of rows 5
1 
2 3 
4 5 6 
7 8 9 10 
11 12 13 14 15