im trying to convert this into a do-while; it is supposed to show a pyramid based on a number that you have entered:
int size,a,b,c;
printf("Enter a Number: ");
scanf("%d",&size);
printf("\n");
// for loop starts here
for(a=1; a<=size; a++)
{
for(b=1; b<=size-a; b++)
{
printf(" ");
}
for(c=1; c<=(2*a)-1; c++)
{
printf("*");
}
printf("\n");
}
getch();
}
this is what i have done so far:
int size;
int a=1;
int b=1;
int c=1;
do {
a++;
do {
c++;
printf("*");
} while(c<=((2*a)-1));
do {
printf(" ");
b++;
} while(b<=(size-a));
printf("\n");
} while(a<=size);
getch();
}
Aaaaand its not showing the same output, any suggestion guys? TIA :)
a,bandcin your second code segment?a,bandc???