I have an assignment due tomorrow for a intro to c class that i am almost done with. This may be a dumb question, but how do you print a space? all by itself? I can left and right justify, but it isnt working for me here. I am kinda lost and its due tomorrow first thing. Any help would be appreciated. It is supposed to be an asterisk printing exercise to look like this:
**********
*********
********
*******
******
*****
****
***
**
*
*
**
***
****
and so on up to ten, which i have figured out, but the next part is to reverse this and have the spaces first, such as :
***********
_**********
__**********
___*********
and so on. Here is what i have so far,
thanks for any help or adviceCode:#include <stdio.h> int main() { int r=0; int c=0; /*pyramid top*/ for ( r= 0; r <10; r++) { for (c=0; c<=r; c++) { printf("*"); } printf("\n"); } printf("\n"); /*pyramid bottom*/ for ( r= 0; r <10; r++) { for (c=10; c>r; c--) { printf("*"); } printf("\n"); } printf("\n"); /*reverse top*/ for ( r= 0; r <10; r++) { for (c=10; c>r; c--) { printf(" "); } } /*reverse bottom*/ for ( r= 0; r <10; r++) { for (c=0; c<=r; c++) { printf("*"); } printf("\n"); } printf("\n"); return 0; }