Untitled
unknown
plain_text
4 years ago
567 B
10
Indexable
#include <iostream> using namespace std; int main(){ int r; while(true){ cout << "Enter number of rows: "; cin >> r; if(r < 3) cout << "That is too few rows for me to make a right-upper trianglei.\n"; else if(r > 23) cout << "That is too many rows for me to make a right-upper trianglei.\n"; else break; } if(r % 2 == 0) r++; for(int i = 1; i < r; i++){ for(int j = i-1; j >= 1; j--){ cout << ' '; } for(int j = r-i; j >= 1; j--){ cout << '*'; } cout << "\n"; } }
Editor is loading...