I'm taking CSCI 230 and was able to get a triangle to print with the following code. I can't get anything to work for a circle or rectangle (similar in size). Can anyone help? Thanks.

#include <stdio.h>
int main()
{
int t;
int x = 0;
int y;
t = 0;
while ( t < 6 )
{
y = 0;
while ( y < t)
{
printf("* ");
y++;
}
if(x == r)
{
printf("\n");
x = t + 1;
}
t++;
}
return 0;
}

I'm taking CSCI 230 and was able to get a triangle to print with the following code. I can't get anything to work for a circle or rectangle (similar in size). Can anyone help? Thanks.

#include <stdio.h>
int main()
{
int t;
int x = 0;
int y;
t = 0;
while ( t < 6 )
{
y = 0;
while ( y < t)
{
printf("* ");
y++;
}
if(x == r)
{
printf("\n");
x = t + 1;
}
t++;
}
return 0;
}

Use code tags and fix the code becouse it won't compile. r is undeclared

Be a part of the DaniWeb community

We're a friendly, industry-focused community of developers, IT pros, digital marketers, and technology enthusiasts meeting, networking, learning, and sharing knowledge.