printing a pyramid

the program given below is not working properly

Page 1 of 1

1 Replies - 6407 Views - Last Post: 22 January 2008 - 01:31 AM Rate Topic: -----

#1 rit_it  Icon User is offline

  • New D.I.C Head

Reputation: 0
  • View blog
  • Posts: 2
  • Joined: 21-January 08

printing a pyramid

Post icon  Posted 22 January 2008 - 01:11 AM

printing a pyramid

using System;
class pyr
{
	static void Main(string[] args)
	{
		int  j,k, m;
		int n;
		Console.WriteLine("No of lines:");
		n = Convert.ToInt32(Console.ReadLine());
		System.Text.StringBuilder sb = new System.Text.StringBuilder();
		for (j = 0; j <= n; j++)
		{
			//sb.Append(j.ToString());
			for (k = 1; k <= n- j; k++)
			{
				Console.WriteLine("*");
				//sb.Append(k.ToString());
				Console.WriteLine("bbbb");

			}
			//Console.WriteLine(sb);
			for (m = 1; m <= j; m++)
			{
				Console.WriteLine("go");
				//sb.Append(m.ToString());
			}
			Console.WriteLine(sb);
			for (m = 1; m < j; m++)
			{
				Console.WriteLine("no");
				//sb.Append(m.ToString());
			}
			//Console.WriteLine(sb);
			
		}
	}
}



thanks

Is This A Good Question/Topic? 0
  • +

Replies To: printing a pyramid

#2 Jayman  Icon User is offline

  • Student of Life
  • member icon

Reputation: 418
  • View blog
  • Posts: 9,532
  • Joined: 26-December 05

Re: printing a pyramid

Posted 22 January 2008 - 01:31 AM

Can you describe how your code is not working properly?

Also, use :code: tags when posting your code.
Was This Post Helpful? 0
  • +
  • -

Page 1 of 1