Posted by MindBreaker 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.