I'm new to C in Visual Studio 2015 and I am working on a code where I need to make 8 patterns made out of "*" using only 1 printf("*");, printf(" "); and printf("\n"); per each pattern. I have the first 3 patterns done correctly and displayed in the code provided; however, patterns 2 and 3 are combined and not seperated by a line using \n didn't do anything and can't use more then one per pattern. (Did I maybe do the "for's" wrong because I sorta just copied and pasted then edited these patterns so not sure if you can put for's in the way I did. Thanks for any help!
#define _CRT_SECURE_NO_DEPRECIATE
#include <stdio.h>
#include <math.h>
void main()
{
int r, s, a; // r = row, s = space, a = star
for (r = 0; r < 4; r++) // Pattern 1
{
for ( a = 0 ; a < 10; a++)
{
printf("*");
}
printf("\n");
}
for (r = 0; r <= 6; r++) // Pattern 2
{
for (a = 0; a < r; a++)
{
printf("*");
}
printf("\n");
}
for (r = 0; r < 5; r++) // Pattern 3
{
for (a = 0; a < 9-r*2; a= a + 1)
{
printf("*");
}
printf("\n");
}
}