Write a C function int rect Area (int len, int wid) that returns the area of a rectangle with length len and width wid. Test it with a main program that inputs the length and width of a rectangle and outputs its area. the value in the main program, not in the function.

Sample Input

6 10

Sample Output

The area of a 6 by 10 rectangle is 60.

Respuesta :

Answer:

int rectArea (int len, int wid)//Function

{

   return len*wid;//return statement.

}

//Main function to test.

int main()

{

   printf("The area of a 6 by 10 rectangle is %d",rectArea(6,10));

  return 0;

}

Explanation:

  • The above function code is in c language, in which there is one return statement which returns the product of the len and wid variable, which is the area of a rectangle.
  • When a user wants to run this program then he needs to mention a header file as studio.h and write the program on c editor and then compile and run that program.
  • The user also needs to define the main function and call this function as shown in the above code, then this code will be run successfully.

Answer:

b

Explanation: