I need help on making an isosceles triangle 2sides with 5 asterisks, and a base with 9 asterisks, and has no asterisks inside the triangle.
I've come up with the codes on a 2sides with 5 asterisks and the base with 9 asterisks, but this time, it has asterisks inside the triangle.
#include<iostream.h>
int main()
{ int a, b, c = 5, d=0;
for(a=1;a<=c;a++)
{
for(b=1;b<=c*2-1;b++)
if (b<=c+d&&b>=c-d)
cout<<"*";
else
cout<<" ";
cout<<"\n";
d++;
}
return 0;
}
And it turns out to be like this:
*
***
*****
*******
*********
What i need is the triangle to look like this:
*
* *
* *
* *
*********
Anyone can help me supply the codes for the isosceles triangle with no asterisks inside the triangle? Help would be appreciated.