Sign Up

Sign Up to our social questions and Answers Engine to ask questions, answer people’s questions, and connect with other people.

Have an account? Sign In

Have an account? Sign In Now

Sign In

Login to our social questions & Answers Engine to ask questions answer people’s questions & connect with other people.

Sign Up Here

Forgot Password?

Don't have account, Sign Up Here

Forgot Password

Lost your password? Please enter your email address. You will receive a link and will create a new password via email.

Have an account? Sign In Now

You must login to ask a question.

Forgot Password?

Need An Account, Sign Up Here

Please briefly explain why you feel this question should be reported.

Please briefly explain why you feel this answer should be reported.

Please briefly explain why you feel this user should be reported.

Sign InSign Up

The Archive Base

The Archive Base Logo The Archive Base Logo

The Archive Base Navigation

  • SEARCH
  • Home
  • About Us
  • Blog
  • Contact Us
Search
Ask A Question

Mobile menu

Close
Ask a Question
  • Home
  • Add group
  • Groups page
  • Feed
  • User Profile
  • Communities
  • Questions
    • New Questions
    • Trending Questions
    • Must read Questions
    • Hot Questions
  • Polls
  • Tags
  • Badges
  • Buy Points
  • Users
  • Help
  • Buy Theme
  • SEARCH
Home/ Questions/Q 9289753
In Process

The Archive Base Latest Questions

Editorial Team
  • 0
Editorial Team
Asked: June 18, 20262026-06-18T20:15:21+00:00 2026-06-18T20:15:21+00:00

I am having a little problem here, I want to draw a vertical pyramid

  • 0

I am having a little problem here, I want to draw a vertical pyramid like this:

O
OO
OOO
OOOO
OOOOO
OOOO
OOO
OO
O

But I can’t seem to figure out how to do it. All I get is:

O
OO
OOO
OOOO
OOOOO
OOOOOO
OOOOOOO
OOOOOOOO
OOOOOOOOO

Here is my code:

int width = 5;

  for (int y = 1; y < width * 2; y++)
  {
    for (int x = 0; x < y; x++)
    {
      Console.Write("O");
    }
    Console.WriteLine();

  }
  • 1 1 Answer
  • 0 Views
  • 0 Followers
  • 0
Share
  • Facebook
  • Report

Leave an answer
Cancel reply

You must login to add an answer.

Forgot Password?

Need An Account, Sign Up Here

1 Answer

  • Voted
  • Oldest
  • Recent
  • Random
  1. Editorial Team
    Editorial Team
    2026-06-18T20:15:22+00:00Added an answer on June 18, 2026 at 8:15 pm

    There are ways to do this with two loops, but here is a way to do it with one, and without an if condition:

    for (int y = 1; y < width * 2; y++)
    {
        int numOs = width - Math.Abs(width - y);
        for (int x = 0; x < numOs; x++)
        {
            Console.Write("O");
        }
        Console.WriteLine();
    }
    
    • 0
    • Reply
    • Share
      Share
      • Share on Facebook
      • Share on Twitter
      • Share on LinkedIn
      • Share on WhatsApp
      • Report

Sidebar

Related Questions

I'm having a little problem here, I want to use next() but I want
Hello guys im having little problem here, Firstly i want to parse string which
I'm having a little problem here, I'm new to Actionscript 3, and what I'm
I'm having a trouble with this little problem. Let's say, I have an array,
Good day, I am having a little bit of a problem. I want to
I'm having a little 'teething' problem here is my code so far <form name=job_app>
I have come across the same problem, but maybe I can give a little
I'm learning Jquery and having some little problem with a piece of code... Here
Hello @ All out there :) I am having a little problem. I want
I'm having a little problem where I want two different classes to be able

Explore

  • Home
  • Add group
  • Groups page
  • Communities
  • Questions
    • New Questions
    • Trending Questions
    • Must read Questions
    • Hot Questions
  • Polls
  • Tags
  • Badges
  • Users
  • Help
  • SEARCH

Footer

© 2021 The Archive Base. All Rights Reserved
With Love by The Archive Base

Insert/edit link

Enter the destination URL

Or link to existing content

    No search term specified. Showing recent items. Search or use up and down arrow keys to select an item.