Ask Question
24 July, 19:46

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.

+1
Answers (1)
  1. 24 July, 22:19
    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?
Find 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 and Technology if you're in doubt about the correctness of the answers or there's no answer, then try to use the smart search and find answers to the similar questions.
Search for Other Answers