i want to use a for loop in a function but error occur.. why??

public double weight( double d)
{
for(int i=0;i<5;i++)
{ d /= 24;}

return d;
}

Recommended Answers

All 4 Replies

'd' is a double, not an array.

error in for loop.. this one { d /= 24;}
so how do i solve it??

'd' is not an array.

Just study some basic java on how to declare variables and arrays.

ok2..thanks..:)

Be a part of the DaniWeb community

We're a friendly, industry-focused community of developers, IT pros, digital marketers, and technology enthusiasts meeting, networking, learning, and sharing knowledge.