0
How to create inverted triangle?
Using for loop. I try hard to make it, but I end up of infinite.
3 Respostas
+ 4
#include <iostream>
using namespace std;
int main() {
int i,j,n;
cout << "Please enter number of row\n";
cin>>n;
cout << "You have entered " << n << endl;
for(i=n;i>=1;i--)
{
for(j=n;j>i;j--)
{
cout << " ";
}
for(j=1;j<2*i;j++)
{
cout << "*";
}
cout << "\n";
}
return 0;
}
+ 1
Sorry for posting in c++, I think you want it in c++. If you want in that I will do that
0
thanks : )