NEED HELP - Math: % (Learn Java)


#1



https://www.codecademy.com/courses/learn-java/lessons/introduction-to-java/exercises/math-2


Hello, everyone.
I'm the new one and I need your help. I've stuck at that exercise trying several combiantions. For example:

16 % 7;
9 % 7;
26 % 8,

but still nothing works.
What am I doing wrong?

p.s. : Forgive me my English if something is wrong. And thank you, of course!)


This is the code:

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

		int myRemainder = 26 % 8;
		System.out.println(myRemainder);

	}
}


#2

The code looks fine. Have you tried a refresh then Run it again?


#3

You have to store remainder in any variable of your choice like this:-
int a = 9 % 2;
System.out.println(a);


#4

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