C++ program to print Floyd's triangle
========================================================================
#include <iostream>
using namespace std;
main()
{
int n, i, j, a = 1;
cout<<"Enter the number of rows of Floyd's triangle to print\n";
cin>>n;
for (i = 1; i <= n; i++)
{
for (j = 1; j <= i; j++)
cout<<a<<" ";
a++;
}
cout<<endl;
}
}
========================================================================
0 comments:
Post a Comment