1. ## Question On Shape

#include <stdio.h>

main ()
{
int height;
int star = 0;

printf("How high would you like the pyramid?\n");
scanf("%d",&height);
if (height > 30) {
printf("Pick another height (must be between 1 and 30):\n");
scanf("%d",&height);
}
while (star!=height) {
printf("*");
printf("*\n");
star=star+1;
}

return 0 ;

}

this is what i did ...
but i want it to be a pyramid in shape printed with "*"

2. Search this board. This question has been asked (and solved)several times.

3. sorry for my newbieness in C language
i have found the sample of my question from some old thread, it is like this :

#include <stdio.h>
#include <ctype.h>
int main(void)
{
int p,q,x,y;
char ch,in;
printf("\nEnter a lower case letter:\n\n");
fflush(stdout);
printf("\nGet a Capital character: \n\n");
scanf("%c",&in);
p=in-'a'+1; /* position in alphabet of in i.e. a=1,b=2,c=3... */
for(x='a',q=p;x<=in;x++)
{
for(y=1;y<q;y++) printf(" "); /* inserts the relevant amount of spaces*/
for(ch='a';ch<=x;ch++) printf("%c",toupper(ch));
for(ch=x-1;ch>='a';ch--) printf("%c",toupper(ch));
printf("\n");
q--;
}
return 0;
}

but i cant figure out on how to convert it to my question .,.*straching head*

4. Here's a good one that handles any size without a lot of complicated looping. :-)
Code:
```#include <stdio.h>
#include <stdlib.h>
#include <string.h>

int main(void)
{
int i;
int spaces;
int height;
char *stars;

printf("Enter the height: ");
if (scanf("%d", &height) != 1)
{
return 1;
}

if ((stars = malloc(height*2 + 1)) == 0)
{
return 1;
}

memset(stars, '*', height*2);
stars[height*2] = '\0';

for (spaces = height, i = 1; spaces > 0; i += 2)
{
printf("%*c%.*s\n", spaces--, ' ', i, stars);
}

free(stars);

return 0;
}```