+ 2

Help,pls.

You are writing a program to calculate the area of a rectangle. Currently it takes the the length and the height as inputs. Complete the given method to take them as arguments, then calculate and return the area. Sample Input 4 5 Sample Output 20 Code: using System; using System.Formats.Asn1; namespace площадь_прямоугольника { class Program { static void Main(string[] args) { int lenght = Convert.ToInt32(Console.ReadLine()); int height = Convert.ToInt32(Console.ReadLine()); Console.WriteLine(Area(lenght,height)); } static int Area(int lenght, int height) { Console.WriteLine(length*height); return length*height; } } }

12th Apr 2021, 8:04 PM
Артем Попов
Артем Попов - avatar
7 Answers
+ 4
Remove; Console.WriteLine(lenght*height); From the Area method and just return the value. P.S. it is spelled length not lenght
12th Apr 2021, 8:09 PM
ChaoticDawg
ChaoticDawg - avatar
+ 1
Thnx a lot)
12th Apr 2021, 11:30 PM
Артем Попов
Артем Попов - avatar
0
Thanks for the awesome information.
1st Nov 2022, 9:07 AM
Alex Sunny
Alex Sunny - avatar
0
Area of a Rectangle Create a function that calculates the area of a rectangle. If the arguments are invalid, your function must return -1. Examples area(3, 4) ➞ 12 area(10, 11) ➞ 110 area(-1, 5) ➞ -1 area(0, 2) ➞ -1 Notes N/A algebrageometrymath Very Easy
14th Dec 2022, 3:17 AM
soumick goswami
soumick goswami - avatar
0
Create a function that calculates the area of a rectangle.
19th Dec 2022, 10:43 AM
Max Stanley
0
namespace SoloLearn { class Program { static void Main(string[] args) { int length = Convert.ToInt32(Console.ReadLine()); int height = Convert.ToInt32(Console.ReadLine()); //Output Console.WriteLine (Area(length , height)) ; } //complete the method static int Area (int length, int height) { return length* height ; } } }
12th Jan 2023, 7:42 AM
mustafa Elwakeel
mustafa Elwakeel - avatar
0
I will try to figure it out for more.
25th Jan 2023, 11:01 AM
Kozlowski