Computer Science, asked by SohamWaghere, 6 months ago

Write an algorithm to find the area of rectangle (formula: A=length * width)

Answers

Answered by rachit42982
0

Answer:

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.

Explanation:

AUR YE JO PEHLA ANSWER DIYA H NA JISNE

VO KRIPYA KARKE AISA ANSWER NA DIYA KARE

OK

FOLLOW ME FOR MORE ANSWERS

MARK AS BRAINLIST

Similar questions