How do you do the modulo operator? I'm stumped!

<PLEASE USE THE FOLLOWING TEMPLATE TO HELP YOU CREATE A GREAT POST!>

<Below this line, add a link to the EXACT exercise that you are stuck at.>

<In what way does your code behave incorrectly? Include ALL error messages.>

```

Replace this line with your code.

<do not remove the three backticks above>

This % is the modulo operator.

I hit the delete button to far that I messed up the code. is it supposed to look like this.System.out.println(myRemainder);

lemme see all your code

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

	int myRemainder 
	System.out.println(myRemainder); 12 % 6 

}

}

its intro to java 9/12

int myRemainder = 14 % 4

Ive done the maths and this should work for a remainder of 2 but have i typed something wrong?

Im confused! Am I supposed to type it in or beside intl my Remainder or (myRemainder)?

I really dont know… :confused:

the problem is here,

you are supposed to store20 % 9; in the variableint myRemainder so it would look like,

int myRemainder = 20 % 9;

then normally print out the variable,

System.out.println(myRemainder);

1 Like

it says this when i try that

Modulo.java:5: error: cannot find symbol
System.out.printIn(myRemainder);
^
symbol: method printIn(int)
location: variable out of type PrintStream
1 error

Thanks man! I really needed that.

1 Like

This is what ive been putting

int myRemainder = 14 % 4;
	System.out.printIn(myRemainder);

int myRemainder = 7 % 5;
how can be remainder 2 after dividing?? anyone??

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