Thursday, August 29, 2013

C++ Program to print floyd triangle

#include<iostream>
using namespace std;
int main(){
int n,a=0,i,j;
cout<<"Enter the number of rows:";
cin>>n;
for(i=0;i<=n;i++){
for(j=0;j<i;j++){
a=a+1;
cout<<" "<<a;
}
cout<<endl;
}
return 0;
}


Output:-

No comments:

Post a Comment

Ads Inside Post