Comments

Wednesday, October 17, 2012

Generate Right Angle Triangle by using function.

Posted by at 8:31 AM Read our previous post
Object
1-      generate right angle triangle by using function.

Source code
#include <iostream>
using namespace std;



int number(int);

int number(int x)
{
       int row;
       for(row=1;row<=x;row++)
       {
              for(int col=1;col<=row;col++)
              {
              cout<<"*";
              }
              cout<<"\n";
       }
       return(0);
}
void main(void )
{int x,answer;
cout<<"Enter number of row"<<endl;
cin>>x;



answer=number(x);
       cout<<answer;

}

Output

No comments:

Post a Comment

Note: Only a member of this blog may post a comment.

Popular Posts

Labels

© Codepirate is powered by Blogger - Template designed by Stramaxon - Best SEO Template