C++ School Assignment? Project Due Tomorrow? Chat LIVE With A Programming Expert!

Welcome to Dream.In.Code
Become a C++ Expert!

Join 299,951 C++ Programmers for FREE! Get instant access to thousands of C++ experts, tutorials, code snippets, and more! There are 1,732 people online right now. Registration is fast and FREE... Join Now!




Inverted pyramid of asterisk

 

Inverted pyramid of asterisk, User enters the number of levels of an inverted pyramid of asterisk.

poppin'champ

3 Jul, 2009 - 07:36 PM
Post #1

New D.I.C Head
*

Joined: 28 Jun, 2009
Posts: 4

here's my code:
CODE
#include<stdio.h>
#include<conio.h>
main()
{
     int z,a,b,c;
     clrscr();
     printf("Level/s:");
     scanf("%d",&c);
     for(z=c;z>=1;z--)
    {
         for(a=0;a<=z;a++)
        {
          printf(" ");
        }
     for(b=c;b>=1;b--)
        {
          printf("*");
        }
     c=c-1;
     printf("\n ");
    }
     getch();
}


the ouput of my code is:
Level/s:4
****
***
**
*

the output should be:
Level/s:4
* * * *
* * *
* *
*
it should be an inverted pyramid.
PLEASE help me!! i need this ASAP. I can't figure it out.
THANX AHEAD!!!

This post has been edited by poppin'champ: 3 Jul, 2009 - 07:43 PM

User is offlineProfile CardPM
+Quote Post


Dantheman

RE: Inverted Pyramid Of Asterisk

3 Jul, 2009 - 08:25 PM
Post #2

D.I.C Regular
***

Joined: 27 May, 2009
Posts: 445



Thanked: 25 times
My Contributions
Sorry dawg. We don't do people's homework here.
User is offlineProfile CardPM
+Quote Post

poppin'champ

RE: Inverted Pyramid Of Asterisk

3 Jul, 2009 - 09:03 PM
Post #3

New D.I.C Head
*

Joined: 28 Jun, 2009
Posts: 4

QUOTE(Dantheman @ 3 Jul, 2009 - 08:25 PM) *

Sorry dawg. We don't do people's homework here.


ow. the spacing in asterisks is all i wanted to ask.. to where i should place space or tab so that the asterisk may appear an inverted pyramid.

can you tell me where??
User is offlineProfile CardPM
+Quote Post

Oler1s

RE: Inverted Pyramid Of Asterisk

3 Jul, 2009 - 09:16 PM
Post #4

D.I.C Addict
****

Joined: 4 Jun, 2009
Posts: 626



Thanked: 66 times
My Contributions
Well, you can see that there are spaces in between the asterisks. Or, another way to look at it is that each asterisk is followed by a space. So if you are outputting '*" repeatedly, you would output what repeatedly instead?

User is offlineProfile CardPM
+Quote Post

Reply to this topicStart new topic

Time is now: 11/6/09 04:52PM

Live C++ Help!

Be Social

Dream.In.Code RSS Feed Dream.In.Code LinkedIn Group Follow Us On Twitter Fan Us On Facebook

C++ Tutorials

Reference Sheets

C++ Snippets

DIC Chatroom

Bye Bye Ads

Monthly Drawing

Thumb Drive

Top Contributors

Top 10 Kudos This Month