Please help me debug.....

I will love you forever if you can tell me what's wrong with my programme......

public class picalculator2

{

public static void main(String[] args)

{

int terms = 2;

int count = 1;

double currentDivided = 1;

int numerator;

int denominator;

int numOne;

int numTwo;

while ( count < terms )

{

numOne=count;

numTwo=count+1;

if (numOne%2 = 0)

{

numOne = numerator;

numTwo = denominator;

}

else

{

numOne = denominator;

numTwo = numerator;

}

currentDivided = currentDivided*(numerator/denominator);

count++;

}

System.out.println(currentDivided);

}

}

[751 byte] By [werekittya] at [2007-11-26 13:55:14]
# 1
change if (numone%2=0) to if(numone%2==0)
AnjanReddya at 2007-7-8 1:34:10 > top of Java-index,Java Essentials,New To Java...
# 2

Please use code tags when you post code.

Also, please include all error messages when you make a post.

I assume your problem is that you are doing this:

if (numOne%2 = 0) and mean to compare instead of assign. Like this:

if (numOne%2 == 0)

Once you correct this I believe you will find other problems that you will need to handle.

zadoka at 2007-7-8 1:34:10 > top of Java-index,Java Essentials,New To Java...
# 3
Thankyou so much :D
werekittya at 2007-7-8 1:34:10 > top of Java-index,Java Essentials,New To Java...