ok here;s my code:
Code:
#include <stdio.h>
main()
{
int shape1, shape2, shape3, shape4, shape5;
int base1, base2, base3, base4, base5;
int height1, height2, height3, height4, height5;
int rot1, rot2, rot3, rot4, rot5;
int row, col;
int space, t, s;
printf("Shapes\n\n");
scanf("%d%d%d%d", &shape1, &base1, &height1, &rot1);
/* ok heres the inputs for the base and height */
if(shape1 == 1 || shape1 == 2)
{
if(shape1 == 1)
{
/* pyramid */
for (row = 1; row <= height1; row++)
{
for (space = height1; space >= row; space--)
printf(" ");
for (col = 1; col <= (row * 2 - 1); col++)
printf("*");
printf("\n");
}
}
else
{
/* top */
for (row = 1; row <= height1; row++)
{
for (space = height1; space >= row; space--)
printf(" ");
for (col = 1; col <= (row * 2 - 1); col++)
printf("*");
printf("\n");
}
/* bottom of diamond */
for (row = 1; row <= height1 - 1; row++)
{
for (space = 1; space <= row + 1; space++)
printf(" ");
for (col = 1; col <= height1 * 2 - (row * 2 + 1); col++)
printf("*");
printf("\n");
}
}
}
return 0;
}
and the output for input: 1 5 6 0 is:
Code:
*
***
*****
*******
*********
***********
which isn't right, i can't figure out what i need to change to make ti work, can anyone help me out some?