Write a float function rectangle() that computes and returns the area of a rectangle using its two float formal parameters h and w, where h is the height and w is the width of the rectangle

maybe something like this?

float rectangle() {
  float h=5;
  float w=5;
  float areaOfRec;
  areaOfRec = h*w;
  return areaOfRec;
}

Are you talking about this?
Well show some code next time. We are here to help not to do your homework.

float recSq(float x, float y){
   return x*y;
   }

Pass hight and width to that function. rectangle(9.3,4.2);

float rectangle(float h, float w)
{
float ans;
ans=h*w;
return ans;
}
commented: You are not only giving the user the answer; you're also posting a less efficient method to the most above. -2
Be a part of the DaniWeb community

We're a friendly, industry-focused community of developers, IT pros, digital marketers, and technology enthusiasts meeting, networking, learning, and sharing knowledge.