PROGRAM
//Program to print a pattern (Floyd Triangle)
# include<iostream>
using namespace std;
int main()
{
int i,j,n,num=1;
cout<<"ENTER THE NUMBER OF ROWS: \n";
cin>>n;
cout<<endl;
for(i=0 ; i<n ; i++)
{
for(j=0 ; j<=i ; j++, num++)
{
cout<<num<<" ";
}
cout<<endl;
}
return 0;
}
OUTPUT
//Program to print a pattern (Floyd Triangle)
# include<iostream>
using namespace std;
int main()
{
int i,j,n,num=1;
cout<<"ENTER THE NUMBER OF ROWS: \n";
cin>>n;
cout<<endl;
for(i=0 ; i<n ; i++)
{
for(j=0 ; j<=i ; j++, num++)
{
cout<<num<<" ";
}
cout<<endl;
}
return 0;
}
OUTPUT