Stuck on question 9 modulo operator


#1

Use the modulo operator to set the variable myRemainder equal to 2. You can use any two numbers that return a remainder value of 2.

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

	int myRemainder = 
	System.out.println(myRemainder);

}

}


#2

same here when i press get code it says it should be 10 % 2; but when i run the code it gives out number 0 and i cant complete the question can some one please help me


#3

9. Math %

Well, something isn't right there. Using the Get code option should not be giving you

int myRemainder = 10 % 2;

not if it wants you to end up with a remainder of 2.

Use the Report a Bug link in that exercise.

@ryan


#4

Exemple:

11 / 3 = (3*3) + 2 ;
11 % 3 = 2;


#5

I don't understand how did that work?


#6

@abaltodano92hotmail_ take a look at this

Post here

it explains the modulo operator


#7

Anyone can help me ? How I can do this exercise?


#8

this did not work for me, I tried several correct answers. has anyone else made it past this step?


#9

I tried:
int myRemainder = 11 % 3;

int myRemainder = 14 % 6;

int myRemainder = 16 % 7;

still showing a red X and not allowing me to continue in the course!


#10

I also tried a lot of options. I wonder when they will fix it, so we can continue..


#11

me too, I hate to show an incomplete course here!


#12

Is there a way to skip this one exercise?


#13

This exercise worked last time I went through it but I'm stuck too. I've reported it, I suggest you do too -- more dings might get attention faster.


#14

I already reported it twice so I hope they notice soon..


#15

Unfortunately no.

Give one of the other courses a try while we wait.


#16

Damn it, I just wanted to practice java xp


#17

Looks like Java ex.12 has a new bug too, so no rush :smile:


#18

Could you give it another try now please?


#19

Worked for me now. Seems this one is working again.


#24

3 posts were split to a new topic: 9. modulo operator