Looping practice ----------------- Problem 1: Write a program that will take in a number from the user and print the reverse of that number. Eg input: 1234 -> output: 4321 int number = 0; int reverse = 0; cout << "Please enter a number: "; cin >> number; while ( number != 0 ) { reverse = (reverse * 10) + ( number % 10 ); number /= 10; } cout << "The reverse is: " << reverse << endl; Problem 2: Write a program that takes in two numbers from the user and prints a star pattern in a rectangular form The first number will be the number of rows The second number will be the number of columns int numberOfRows = 0; int numberOfCols = 0; cout << "Please enter the number of rows: "; cin >> numberOfRows; cout << "Please enter the number of columns: "; cin >> numberOfColumns; for(int r= 0; i < numberOfRows; r++) { //Used to iterate over columns of each rows for(int c = 0; c < numberOfColumns; c++) { cout << '*'; } //Move to the next line/row cout << endl; } Problem 3: Write a program that takes in a number and prints a pyramid star pattern. The pattern for 5 would look like this: * *** ***** ******* ********* int number = 0; cout << "Please enter a number: "; cin >> number; for(int i=0; i < number ; i++) { //Prints trailing spaces for(int j = 0; j < number-i-1; j++) { cout << ' '; } //Prints the pyramid pattern for(int j = 0; j < (2*i + 1 ); j++) { cout << '*'; } cout << endl; }