Intellipaat Back

Explore Courses Blog Tutorials Interview Questions
0 votes
2 views
in Java by (2.6k points)

As an example in pseudocode:

if ((a mod 2) == 0)
{
    isEven = true;
}
else
{
    isEven = false;
}

1 Answer

0 votes
by (7.2k points)

Modulus in Java: Syntax

X%Y

 

class Mod{

public static void main(String[] args){

int n1,n2,R;

n1=36;

n2=25;

System.out.println("n1=36; n2=25");

R=n1%n2;

System.out.println("The result after modulus operation is : "+result);

}

}

Output:

n1=36 n2=25

Related questions

0 votes
1 answer
asked Sep 11, 2019 in Java by Krishna (2.6k points)
0 votes
1 answer
0 votes
1 answer

Browse Categories

...