What is wrong with Modulo in sect 9 of Intro to Java?


#1

What is wrong with the modulo line in Learning Java? Not working!!!!

Replace this line with your code.


#2

can you post your code here so we can see what you tried :slight_smile:


#3

public class Modulo {
public static void main(String[] args) {

    int myRemainder = 7 % 5
    System.out.println(myRemainder);

}

}


#4

i think the error massage you are getting?

Modulo.java:4: error: ';' expected
		int myRemainder = 7 % 5
                                       ^

so need a ;

int myRemainder = 7 % 5 ; // <= here


#5

used ; and it worked. thanks for the fast reply : )


#6

This topic was automatically closed 7 days after the last reply. New replies are no longer allowed.