So i have assignment to type a code which will ask me for a "w". After i type in a number it will create a rhombus with a diagonal which is 2w. The rhombus must be made of intervals and * . The problem that i face now is that when i type w=5 the diagonal is 5 instead of 10 ....
main()
{
int w;
int i;
int j;
printf("w: ");
scanf("%d", &w);
printf("");
i = 0;
while (w >= i)
{
for (j = 0; j < (w - i); j++)
printf(" ");
for (j = 0; j < i + 1; j++) {
printf("*");
if (j <= i) {
printf(" ");
}
}
printf("\n");
i = i + 1;
}
i = w - 1;
while (i >= 0)
{
for (j = 0; j < (w - i); j++)
printf(" ");
for (j = 0; j < i + 1; j++) {
printf("*");
if (j <= i) {
printf(" ");
}
}
printf("\n");
i = i - 1;
}
return 0;
}