samedi 21 février 2015

Unwanted newline appearing

Whenever I run my program, it doesn't start printing the asterisks until after a newline, why? Here is my code:



int main()
{
int createRow = 0,
createCol;

while (createRow <= 5)
{
while (createCol <= ((createRow * 2) - 1))
{
printf("*");
createCol++;
}
createCol = 1;
createRow++;

printf("\n");
}
return 0;
}


Output:



*
***
*****
*******
*********
***********
*************
***************
*****************
*******************


As you see, right before the very first asterisk, there is a newline. How do I fix this?





Aucun commentaire:

Enregistrer un commentaire