Program for length and area of rectangle using functions
<p>I need to write a program that computes the area and perimeter of a rectangle. It must use a function for the area, and a second function for the perimeter.  </p>

<pre class="lang-c prettyprint-override"><code>perimeter = 2 x length + 2 x width = 2l + 2w
area = legnth x width = l x w
</code></pre>

<p>So far my code is this:</p>

<pre><code>#include &lt;stdio.h&gt;
double perimeter(double x);
double area(double w);
int main (){
    double x, w;
    printf("Enter the length: ");
    scanf("%lf", &amp;x);
    prntf("Enter the width: ");
    scanf("%lf", &amp;w)
    printf("The perimeter is %lf\n", perimeter);
    printf("The area is %lf\n", area);
    return 0;   
}   
double perimeter(double x, w){
    return (2*x)+(2*w);
}
double area(double x, w){
    return (x*w);
}
</code></pre>

<p>I am getting the following errors:</p>

<blockquote>
  <p>(17): error C2146: syntax error: missing ';' before identifier 'printf'<br>
  (17): warning C4477: 'printf' : format string '%lf" requires an argument of type 'double', but variadic argument 1 has type 'double (___cdecl *)(double)'<br>
  (18): warning C4477: 'printf' : format string '%lf" requires an argument of type 'double', but variadic argument 1 has type 'double (___cdecl *)(double)''<br> 
  (21): error C2081: 'w': name in formal parameter list illegal<br>
  (21): warning C4029: declared formal parameter list different from definition<br>
  (24): error C2081: 'w': name in formal parameter list illegal <br>
  (24): warning C4029: declared formal parameter list different from definition </p>
</blockquote>