tank volume calcul

hello

i want to calculate volume of Tank, but i have this error
return-statement with a value, in function returning ‘void’ [-fpermissive]
return v=(s * l) / 1000.0;

my function

long duration;
int h;
const double l = 26.0;
const double r = 6.0;
double s = 0;
double v = 0;



h= duration*0.034/2;

if ((h >= 0) && (h < r))
    s = r * r * atan(sqrt(2 * r * h - h * h) / (r - h)) - (r - h) * sqrt(2 * r * h - h * h);
  else if ((h >= 0) && (h == r))  
  s = M_PI * r * r / 2;
  else if ((r >= 0) && (r < h) && (h <= 2 * r))
    s = M_PI * r * r + (h - r) * sqrt(2 * r * h - h * h) - r * r * atan(sqrt(2 * r * h - h * h) / (h - r));
  return v=(s * l) / 1000.0;

Serial.println(s);

Moderator edit:
</mark> <mark>[code]</mark> <mark>

</mark> <mark>[/code]</mark> <mark>
tags added.

What error?
I'd go with unsigned long for this one
long duration;
and also for h.

Didn't you post this else where as well? Don't do that - post once, have some patience.

This topic is locked.

@moayadassil, stop cross-posting. Other threads removed.

The fragment that you posted is not a function.