← Back to Structs
Question 237
Rectangle Struct: Compute the Area
Rectangle Struct: Compute the Area
Define a struct type named Rectangle with two integer fields, width and height. In main, create a Rectangle, set its width to 5 and its height to 4, then print its area (width times height) exactly as: Area: 20 followed by a newline. You are combining struct fields with a simple multiplication.
Expected Output:
Area: 20= newline. The output ends with a newline — print one after the last line.
Hints4 available
Sign in to use hintsTopics:
Structs
1
Tab to indent (Esc then Tab to move on) · Ctrl+Enter to run · Shift+Alt+F to format · Ctrl+Space to expand shortcuts (p, fori)
Your Output
Run your code to see the output here...
Test Cases
Run your code to see test case results.