Exerpad
🔥0
0 XP
Lv.1 Beginner
Log In

Rectangle Struct

Define a struct called Rectangle with two fields: width (i32) and height (i32). Create a rectangle with width 8 and height 5, then print its area.

Expected output:

text
Area: 40

Hints:

  • Define the struct with i32 fields for width and height
  • Calculate the area by multiplying rect.width * rect.height
rust
fn main() {
}