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


#1



Replace this line with your code.


#2

This % is the modulo operator.


#3

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


#4

lemme see all your code


#5

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

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

}

}


#6

its intro to java 9/12


#7

int myRemainder = 14 % 4

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


#8

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


#9

I really dont know.. :confused:


#10

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);


#11

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


#12

Thanks man! I really needed that.


#13

This is what ive been putting

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

#14

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


#15

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