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;
}

2
Contributors
1
Reply
2
Views
12 Years
Discussion Span
Last Post by andor
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

This topic has been dead for over six months. Start a new discussion instead.
Have something to contribute to this discussion? Please be thoughtful, detailed and courteous, and be sure to adhere to our posting rules.