Author: ClayShannon | Posted on: 9/22/2008 9:20:09 AM | Views : 286

If ANumCorrect = 2 and ANumIncorrect = 1, I would expect the else statement to return 66.7, but it's returning 0; what am I doing wrong? Here's my code: 

    private double GetCorrectPercentage( int ANumCorrect, int ANumIncorrect )
    {
      //Disallow a DivByZero error:
      if (ANumCorrect == 0)
      {
        return 0.0;
      }
      else if (ANumIncorrect == 0)
      {
        return 100.0;
      }
      else
      {
        double d = ((ANumCorrect / (ANumCorrect + ANumIncorrect)) * 100);
     &nbs ...

Go to the complete details ...