Ask Question
22 October, 11:15

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.

+5
Answers (1)
  1. 22 October, 14:44
    0
    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.
Know the Answer?
Not Sure About the Answer?
Get an answer to your question ✅ “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 ...” in 📙 Computers & Technology if there is no answer or all answers are wrong, use a search bar and try to find the answer among similar questions.
Search for Other Answers