Computer Science, asked by surajkumar3675, 1 year ago

Algortihm to find the area of the rectangle

Answers

Answered by abhinavprajit
0

Take a step back here and ask the question, how do I calculate the area of a rectangle? If you don’t know this, then it’s impossible for you to write an algorithm. Algorithms are solutions for how a computer solves a given problem. In this case, multiplication because that’s how we solve it ourselves.

I’m thinking you are having difficulties understanding what an algorithm is and how to represent it in a programming language. Also I’m thinking you are having problems with programming in general because the solution to your problem is fundamentals in programming. It’s really just one line of code to get the area providing you have the two variables defined for width and height.

double W = 4.0;

double H = 5.0;

double A = W * H; //Area of a rectangle

It’s the simplest of algorithms because it’s just a multiplication problem. My suggestion is to review programming where it concerns solving math problems. I’m not convinced you have mastery over this. It would be hard to progress into deeper algorithms without mastery in this.

do mark brainliest

Similar questions