.NET Tutorials, Forums, Interview Questions And Answers
Welcome :Guest
 
Sign In
Register
 
Win Surprise Gifts!!!
Congratulations!!!


Top 5 Contributors of the Month
david stephan

Home >> Forum >> C# >> Post New QuestionBookmark and Share Subscribe to Forum

How To Make Peramid In C#

Posted By: Naim Khan     Posted Date: May 28, 2010    Points:2   Category :C#
hello friends,

I want to print Pyramid in C#.. if you have any idea how can i make it then please help me i need your help...

*
* * *
* * * * *
* * * * * * *
* * * * * * * * *

thanks in Advance
Naim Khan


Responses
Author: Lalij Mer             
Posted Date: May 28, 2010     Points: 5   

Try this Code Sample


using System;
using System.Collections.Generic;
using System.Text;

namespace Pyramid
{
class Program
{
static void Main(string[] args)
{
try
{
Console.Write("Enter the Height of the Pyramid: ");
int n = Convert.ToInt32(Console.ReadLine());
for (int i = 1; i <= n; i++)
{
for (int j = n; j >= i; j--)
{
Console.Write(" ");
}
for (int k = 1; k <= i; k++)
{
Console.Write("*");
}
for (int m = 2; m <= i; m++)
{
Console.Write("*");
}
Console.WriteLine();
}
}
catch (Exception ex)
{
Console.WriteLine(ex.Message);
}
}
}
}


You will also get sample code from this link
http://social.msdn.microsoft.com/Forums/en-US/csharplanguage/thread/8d81217d-aa5b-4988-b4df-9427a82e14d0

Please Check my answer if you help....
Thank You...

Lalit.
Author: BangaruBabuPureti             
Posted Date: May 31, 2010     Points: 5   

Check this link ..

Which Gives Total Program on hands

http://www.daniweb.com/forums/thread133359.html

BangaruBabu Pureti
http://bangarubabupureti.spaces.live.com/


Post Reply

You must Sign In To post reply
 
 
Find more Forum Questions on C#, ASP.Net, Vb.Net, SQL Server and more Here
Quick Links For Forum Categories:
ASP.NetWindows Application  .NET Framework  C#  VB.Net  ADO.Net  
Sql Server  SharePoint  OOPs  SilverlightIISJQuery
JavaScript/VBScriptBiztalkWPFPatten/PracticesWCFOthers
www.DotNetSpark.comUnAnsweredAll

Hall of Fame    Twitter   Terms of Service    Privacy Policy    Contact Us    Archives   Tell A Friend