Hiya,
I am tried so may be missing something, but I dont know why this piece from my code is not working. By the time it gets to here var=147, but it only implements the final else statement, ignoring the true var%7 == '0'. I have never included an equation in else before, but setting it as an external var makes no difference. Have tried less brackets (not that that matters here). 147/7=21. Never used mod remainder before. Thanks.
Code :
if ( (var%10) == '0') {
quo = 10;
System.out.println("quo" +quo);
}
else if ((var%9) == '0') {
quo = 9;
System.out.println("quo" +quo);
}
else if ((var%8) == '0') {
quo = 8;
System.out.println("quo" +quo);
}
else if ((var%7) == '0') {
quo = 7;
System.out.println("quo" +quo);
}
else if ((var%6) == '0'){
quo = 6;
System.out.println("quo" +quo);
}
else if ((var%5) == '0'){
quo = 5;
System.out.println("quo" +quo);
}
else if ((var%4) == '0'){
quo = 4;
System.out.println("quo" +quo);
}
else if ((var%3) == '0'){
quo = 3;
System.out.println("quo" +quo);
}
else if ((var%2) == '0'){
quo = 2;
System.out.println("quo" +quo);
}
else {
System.out.println("quo not divisible");
}