I have been trying to do my project for the past 2 weeks but cannot think of any other ways to make it works. This is an important project to me if I want to get a passing grade in this class. So if anyone think they can help me out with this, please feel free to do so because I can not think of a way to make it works. Thanks
project 1.
create the following diagram
use 2 while loop to control row and column
use if statement to determine if stars should be increased or decreased.
*
* *
* * *
* * * *
* * * * *
* * * *
* * *
* *
*
here is my here is what I came up with
(I am using Navajo)
#include <stdio.h>
int main (void)
{
int row;
int column;
row=1;
while (row<=9)
{
column=1;
while(column <=5)
{
printf("* ");
column++;
}
printf("\n");
row++;
}
if (row)
{
printf (" ");
row++;
}
else
{
printf(" ");
row--;
}
return 0;
}
and here is the diagram I got. It seem like my if/else statement is not recognize by the program. what is wrong with the code?
[nvan1@navajo ~]$ c++ project1.c
[nvan1@navajo ~]$ ./a.out
* * * * *
* * * * *
* * * * *
* * * * *
* * * * *
* * * * *
* * * * *
* * * * *
* * * * *
[nvan1@navajo ~]$