Computer Science, asked by kevinkomaravalli, 11 months ago

What is the difference between ‘/’ ‘%’ in java​

Answers

Answered by namrata6969
1

Answer:

/ will give u remainder

% will give u quotient

Answered by duragpalsingh
1

Hey there!

Difference between "/" and "%" in Java:

• '/' symbol is of division and '%' symbol is called modulus.

• '/' gives the quotient while '%' gives remainder.

For Example:

class Abc

{

public static void main(String args[])

{ int a,b,q,r = 0;

a = 17;

b =  5;

q = 17/5;

r = 17%5;

System.out.println("Quotient="+q);

System.out.println("Remainder="+r);

}

}

Sample Output:

Quotient = 3

Remainder = 2

Good day!

Similar questions