> if ( (h2 % h1) ==67); {
if ( (h2 % h1) ==67) {
Lose the ';'. That effectively ends the 'if'.

Signature
Andrew Thompson
http://www.PhySci.org/codes/ Web & IT Help
http://www.PhySci.org/ Open-source software suite
http://www.1point1C.org/ Science & Technology
http://www.LensEscapes.com/ Images that escape the mundane
Danny Gopie - 29 Nov 2004 15:34 GMT
thanks, but it still doesnt work as it should, my question is
a = 0.0 and still it prints out these last 2 lines why??
I have the complete script here
public class hele {
public static void main(String[] args) {
double h1 = 3;
double h2 = 6;
double p1 = 5;
double p2 = 8;
double a = h2 % h1;
System.out.println(a);
if ( (h2 % h1) ==0.0) {
System.out.println(+ h2+ " is een veelvoud van" + h1);
} if ( (h1 % h2) ==0.0) {
System.out.println(+ h1+ " is een veelvoud van" + h2);
} if (p1 % p2 ==0.0 ){
System.out.println(+ p1+ " is een veelvoud van" + p2);
} if (p2 % p1 ==0.0 ){
System.out.println(+ p2+ " is een veelvoud van" + p1);
////// LAST 2 LINES WHICH SHOULDN;t be printed
}if ( h1 % h2 !=0.0|| h2 % h1 !=0.0){
System.out.println("de hele getallen zijn geen veelvoud van
mekaar");
} if ((p1 % p2 !=0.0) || (p2 % p1 !=0.0) ){
System.out.println("de positieve getallen zijn geen
veelvoud van mekaar");
} }
}
It seems I did not look closely enough at this first time..
> public class hele {
> public static void main(String[] args) {
[quoted text clipped - 3 lines]
> double p1 = 9;
> double p2 = 8;
Comparing doubles for equality will usually fail, as..
<http://www.xdweb.net/~dibblego/java/faq/answers.html#Q41>
And to follow Java naming conventions, 'hele' should be 'Hele'.
It would also help to have more meaningful attribute names.

Signature
Andrew Thompson
http://www.PhySci.org/codes/ Web & IT Help
http://www.PhySci.org/ Open-source software suite
http://www.1point1C.org/ Science & Technology
http://www.LensEscapes.com/ Images that escape the mundane
Danny Gopie - 29 Nov 2004 15:46 GMT
Thanks, I changed all the doubles to int. but the problems remains,
what is the rpbolem here?
> It seems I did not look closely enough at this first time..
>
[quoted text clipped - 11 lines]
> And to follow Java naming conventions, 'hele' should be 'Hele'.
> It would also help to have more meaningful attribute names.
Mike B - 29 Nov 2004 16:13 GMT
> Thanks, I changed all the doubles to int. but the problems remains,
>
> what is the rpbolem here?
Try running this and see if you can see what the "problem" may be.
<sscce> public class Hele {
public static void main(String[] args) {
int h1 = 3;
int h2 = 6;
int p1 = 5;
int p2 = 8;
System.out.println(h2 % h1);
if ( (h2 % h1) ==0)
{
System.out.println(+ h2+ " is een veelvoud van" + h1);
}
if ( (h1 % h2) ==0)
{
System.out.println(+ h1+ " is een veelvoud van" + h2);
}
if (p1 % p2 ==0 )
{
System.out.println(+ p1+ " is een veelvoud van" + p2);
}
if (p2 % p1 ==0 )
{
System.out.println(+ p2+ " is een veelvoud van" + p1);
}
////// LAST 2 LINES WHICH SHOULDN;t be printed
if ( h1 % h2 !=0|| h2 % h1 !=0)
{
System.out.println(h1 % h2 + " OR " + h2 % h1);
System.out.println("de hele getallen zijn geen veelvoud van mekaar");
}
if ((p1 % p2 !=0) || (p2 % p1 !=0) )
{
System.out.println(p1 % p2 + " OR " + p2 % p1);
System.out.println("de positieve getallen zijn geen veelvoud van
mekaar");
}
}
}
</sscce>

Signature
Mike B
Stefan Schulz - 29 Nov 2004 19:58 GMT
> {
> System.out.println(+ h2+ " is een veelvoud van" + h1);
> } ^
|
+---- What does this lonely plus do here?

Signature
Whom the gods wish to destroy they first call promising.
Mike B - 30 Nov 2004 02:15 GMT
>> {
>> System.out.println(+ h2+ " is een veelvoud van" + h1);
>> } ^
> |
> +---- What does this lonely plus do here?
Uh, can I plead haste? I was in a hurry and didn't look at the OP's code too
finely. He has all his printlns like that. I just didn't clean it up.

Signature
Mike B