C++ Program to print Floyd Triangle [DEVCPP/GCC]

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

C++ Program to print Floyd Triangle with output

Share this

Related Posts

FIND US ON FACEBOOK!