(a) Please draw the output pattern. (b) Please replace the 1st while loop to for loop (line 13 – 17) and make sure the p
Posted: Fri May 20, 2022 5:19 pm
(a) Please draw the output pattern. (b) Please replace the 1st while loop to for loop (line 13 – 17) and make sure the program still works properly. (5 + 5 = 10 points) #include <iostream> 5 using namespace std; sint main() { 4 int row - 4, digit = 0; 6 7 8 9 10 11 12 13 14 15 16 17 for (int i = 1; i <= row; i++) { -D int j = 1; while (j <- row - i) { cout << " "; j++; } 18 int k = }} while (k <= row) { cout << digit; k++; } 19 20 21 22 23 24 25 26 27 28 29 30 digit++; cout << endl; } cout << endl; system("pause"); return; }