Rectangle area | Sololearn: Learn to code for FREE!
New course! Every coder should learn Generative AI!
Try a free lesson
0

Rectangle area

https://www.sololearn.com/compiler-playground/cQ6I0oVFIWJx Write a function that takes two positive integers that represent the length and width of the rectangle. The function calculates the area of the rectangle and returns its result. (Inputs) width = 9 height = 8 (Outputs) 72

10th Nov 2022, 2:22 PM
STOP
STOP - avatar
3 Answers
+ 2
https://code.sololearn.com/cMlP1hKolKkU/?ref=app You're missing the main section of the code. Do you need to accept inputs or just those two values? If you need to accept inputs, you can import the Scanner and put that in there.
10th Nov 2022, 2:36 PM
Ausgrindtube
Ausgrindtube - avatar
+ 1
i want to use public static int area_of_rectangle(int width, int height) {
10th Nov 2022, 2:54 PM
STOP
STOP - avatar
+ 1
You need the main. You can send the values to your area... and have it return them. https://www.thoughtco.com/main-class-2034233
10th Nov 2022, 3:59 PM
Ausgrindtube
Ausgrindtube - avatar