Inverted pyramid of asterisk

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

Page 1 of 1

3 Replies - 21852 Views - Last Post: 03 July 2009 - 10:16 PM Rate Topic: -----

#1 poppin'champ  Icon User is offline

  • New D.I.C Head

Reputation: 0
  • View blog
  • Posts: 6
  • Joined: 28-June 09

Inverted pyramid of asterisk

Posted 03 July 2009 - 08:36 PM

here's my 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: 03 July 2009 - 08:43 PM


Is This A Good Question/Topic? 0
  • +

Replies To: Inverted pyramid of asterisk

#2 Dantheman  Icon User is offline

  • D.I.C Regular

Reputation: 34
  • View blog
  • Posts: 445
  • Joined: 27-May 09

Re: Inverted pyramid of asterisk

Posted 03 July 2009 - 09:25 PM

Sorry dawg. We don't do people's homework here.
Was This Post Helpful? 0
  • +
  • -

#3 poppin'champ  Icon User is offline

  • New D.I.C Head

Reputation: 0
  • View blog
  • Posts: 6
  • Joined: 28-June 09

Re: Inverted pyramid of asterisk

Posted 03 July 2009 - 10:03 PM

View PostDantheman, on 3 Jul, 2009 - 08:25 PM, said:

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??
Was This Post Helpful? 0
  • +
  • -

#4 Oler1s  Icon User is offline

  • D.I.C Lover
  • member icon

Reputation: 1395
  • View blog
  • Posts: 3,884
  • Joined: 04-June 09

Re: Inverted pyramid of asterisk

Posted 03 July 2009 - 10:16 PM

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?
Was This Post Helpful? 0
  • +
  • -

Page 1 of 1