Error using Pow(a,b)

Asked

Viewed 694 times

-1

#include <stdio.h>
#include<math.h>

int main() {

double pi = 3.14159;
double R, A;

scanf("%lf", &R);
A = (pi)* pow(double R, int 2);
printf("%lf\n", A);

return 0;
}

This code is returning the error: Too few Arguments to Function 'Pow' why?

  • By the way: Math. h already defines pi: M_PI * pow(R,2)

1 answer

1


Try calling the function as follows:

A = pi * pow(R, 2);

and see if the error persists.

The parentheses in pi is not necessary (but also does not cause error), the error was because you were invoking the function with the data types, which is not accurate

  • 2

    Or rather, replace pow(R, 2) for R * R.

  • If the power is fixed, and a low value as is the case, it is better to make it easier as @Victorstafusa mentioned, unless it is clear that it is a job that requires you to use the Pow function or the power is variable or unknown...

  • Problem solved, thanks! I wanted to use the function Pow to fix even... sometimes I forget that it exists, I’m beginner.

Browser other questions tagged

You are not signed in. Login or sign up in order to post.