// Call this line in main method
drawT(10);
public void drawT(int n)
{
for(int i=n; i > 0; i --)
{
drawSpace(i);
drawStar(n-(i-1));
Response.Write("
");
}
for(int i=1; i < n; i++)
{
drawSpace(i+1);
drawStar(n-i);
Response.Write("
");
}
}
public void drawStar(int n)
{
if(n ==0) return;
Response.Write("1");
drawStar(n-1);
}
public void drawSpace(int n)
{
if( n == 1) return;
Response.Write(" ");
drawSpace(n-1);
}
Tuesday, March 11, 2008
Draw rhombus using recursive method in C#
Subscribe to:
Post Comments (Atom)
0 Comments:
Post a Comment