User Name Password Register
DaniWeb IT Discussion Community
All
What is DaniWeb IT Discussion Community?
You're currently browsing the C# section within the Software Development category of DaniWeb, a massive community of 391,608 software developers, web developers, Internet marketers, and tech gurus who are all enthusiastic about making contacts, networking, and learning from each other. In fact, there are 2,611 IT professionals currently interacting right now! Registration is free, only takes a minute and lets you enjoy all of the interactive features of the site.
Please support our C# advertiser:
Views: 162 | Replies: 1
Reply
Join Date: Feb 2008
Posts: 12
Reputation: arupa is an unknown quantity at this point 
Rep Power: 1
Solved Threads: 0
arupa arupa is offline Offline
Newbie Poster

pyramid

  #1  
Jul 8th, 2008
write a program to view a pyramid structure of a input number. pyramid should look like this
if number is 5
then pyramid will be
1
1 2 1
1 2 3 2 1
1 2 3 4 3 2 1
1 2 3 4 5 4 3 2 1
Arupananda Behera
AddThis Social Bookmark Button
Reply With Quote  
Join Date: Jul 2008
Posts: 1
Reputation: karidoe is an unknown quantity at this point 
Rep Power: 0
Solved Threads: 0
karidoe karidoe is offline Offline
Newbie Poster

Re: pyramid

  #2  
Jul 9th, 2008
Hi, I'm not sure that your meaning like this ..........
using System;
using System.Collections.Generic;
using System.Linq;
using System.Text;

namespace pyramid
{
    class Program
    {
        static void Main(string[] args)
        {
            Console.Write("IN PUT YOUR NUMBER :");
            int myInt = int.Parse(Console.ReadLine());
            for (int iCount1 = 1; iCount1 <= myInt; iCount1++)
            {
                for (int iCount2 = 1; iCount2 <= iCount1; iCount2++)
                {
                    Console.Write(iCount2 + " ");
                }
                for (int iCount3=(iCount1-1);iCount3 >= 1; iCount3--)
                {
                    Console.Write(iCount3 + " ");
                }
                Console.WriteLine("");
            }
        }
    }
}
Last edited by karidoe : Jul 9th, 2008 at 6:55 am.
Reply With Quote  
Reply

Only community members can participate in forum threads. You must register or log in to contribute.

Currently Active Users Viewing This Thread: 1 (0 members and 1 guests)

 

DaniWeb C# Marketplace
Thread Tools Display Modes

Similar Threads
Other Threads in the C# Forum

All times are GMT -4. The time now is 12:03 am.
Forum system based on vBulletin Copyright ©2000 - 2008, Jelsoft Enterprises Ltd.
©2003 - 2008 DaniWeb® LLC