/*reads in the number of rows and prints n rows of digits. for example, if n = 5
ID: 672076 • Letter: #
Question
/*reads in the number of rows and prints n rows of digits.
for example, if n = 5:
12345
1234
123
12
1
*/
#include <iostream>
using namespace std;
int main()
{
int rows(0),col(0),i(0),n(0),k(0);
cout <<"Enter the number of rows: ";
cin >> rows;
cout <<"1";
while( rows <= 0) // ture statment so go ies
{
i <= 0;
while( col <= rows -1)
{
cout << rows;
col++;
}
rows ++;
}
return(0);
}
need help with while loops im not very good at them please explain
Explanation / Answer
you can also try this without while see the program given below #include using namespace std; int main() { int i,j,rows; coutrows; for(i=rows;i>=1;--i) { for(j=1;jRelated Questions
Navigate
Integrity-first tutoring: explanations and feedback only — we do not complete graded work. Learn more.