need python code Write a program that shall ask the user to enter width W and he
ID: 3889455 • Letter: N
Question
need python code
Write a program that shall ask the user to enter width W and height H as two integer numbers and display a rectangle of H rows and W columns made of the pound signs (“#”), as in the following example:
Enter rectangle height: 3 Enter rectangle width: 25
#########################
#########################
#########################
Your program shall not use loops, even if you know how to use them.
Explanation / Answer
#include // Needed to use IO functions using namespace std; int main() { int sumOdd = 0; // For accumulating odd numbers, init to 0 int sumEven = 0; // For accumulating even numbers, init to 0 int upperbound; // Sum from 1 to this upperbound int absDiff; // The absolute difference between the two sums // Prompt user for an upperbound cout > upperbound; // Use a while-loop to repeatedly add 1, 2, 3,..., to the upperbound int number = 1; while (number sumEven) { absDiff = sumOdd - sumEven; } else { absDiff = sumEven - sumOdd; } // Print the results coutRelated Questions
Navigate
Integrity-first tutoring: explanations and feedback only — we do not complete graded work. Learn more.