format problem

hey everyone, Im making a program that prints different patterns using *
like this:
*
***
*****
*******
*****
***
*

i am letting the user decide what the number of rows can be, i want the shape to appear on the left (60 spaces from the right) if it is even and on the right if they choose an odd number. Any suggestions on how to get them to print in that format?

thanks

this seems to be from a question/exercise in a book.
What have you got so far?

Well, my program is set up so that after the user enters in a number then it goes through an if statement. The If statement correctly display the right number of stars per line, but right now now matter if the number is even or else the number is odd it only displays on the right side of the page. Also the stars all display in a straight line against the right. I want to for a dimond shape.

inside the if else statement i have a for loop in both the if and the else. which is what gets the *'s displayed.

Post ur code.

heres what i have.

#include <stdio.h>
int main()
{
int r, rs, astr;
rs=2; /i am hardcoding the rs value here/

if(rs/2%0){
/here i want to have it right aligned/
for(r=1, r<=rs, r++){
for(astr=1, astr<=rs, astr++)
printf("*");}

else
/here i want to have it left aligned/
for(r=1, r<=rs, r++){
for(astr=1, astr<=rs, astr++)
printf("*");}

}
return EXIT_SUCCESS;
}

code tags for code please. like {code} stuff {/code} except with [ ] instead of { }. And align your code so people can read it.

#include <stdio.h>
int main()
{
  int r, rs, astr;
  rs=2; /*i am hardcoding the rs value here*/

  if(rs/2%0)
  {
    /*here i want to have it right aligned*/
    for(r=1, r<=rs, r++){
    for(astr=1, astr<=rs, astr++)
      printf("*");
  }
  else
  /*here i want to have it left aligned*/
  for(r=1, r<=rs, r++)
  {
    for(astr=1, astr<=rs, astr++)
      printf("*");
  }
}
  return EXIT_SUCCESS;
}

Aligning it reveals you have too many brackets.

To right-align your output, print spaces in front of things. The number of spaces will be inversely proportional to the number of asterisks you need to print.

You can simplify the if(rs/2%0) thing into if(rs&1)