I do not know where to put the division problem on Modulo java?


#1

I do not know where to put the division problem on Modulo java ?


#2

Hey mcpemods101, it will be easier for everyone
to help you if you put the code in here for us to see
what you are having problems with, thanks!


#3

Pls put your code in @mcpemods101. Cant wait to see Java :smiley:


#4

1 public class Modulo {

2 public static void main[[cstring[]args{

3

4 int(myremainder);

5 system.out.println(myremainder)

6

7 }

8 }


#5

@mcpemods101, I noticed in the code you entered
above, you didn't add a " ; " after

System.out.println(myremainder)

Edit :
I had to go back to the lesson you were on to understand
exactly what you were saying. It's telling you to use the
Modulo operator to get a result of "2 "using any two numbers
you like. It gave you an example of 15 % 6 wich would equal 3
because 6 goes into 15 2.3 times. So you're going to need to
come up with two numbers divided into each other that give you
a remainder of "2".

Example

int myremainder = 20 % 8;

The result of that would be 4.


#6

?? That is not how you initalize a variable. You do

int myRemainder = something.


#7

It seems that I ran into trouble with this question as well. I was thinking as to why I wasn’t getting the right answer. Make sure you choose two numbers that result in a remainder (2) & do not forget to add a (:wink: in the end of a statement.

e.g.

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

	int myRemainder = 14 % 3;
	System.out.println(myRemainder);

}

}


#8