0

How to create inverted triangle?

Using for loop. I try hard to make it, but I end up of infinite.

24th Nov 2016, 10:32 AM
Vanessa Añasco
Vanessa Añasco - avatar
3 Respuestas
+ 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; }
24th Nov 2016, 1:07 PM
Aditya kumar pandey
Aditya kumar pandey - avatar
+ 1
Sorry for posting in c++, I think you want it in c++. If you want in that I will do that
24th Nov 2016, 1:46 PM
Aditya kumar pandey
Aditya kumar pandey - avatar
0
thanks : )
24th Nov 2016, 1:33 PM
Vanessa Añasco
Vanessa Añasco - avatar