1.

What is the difference between / and % operator ?

Answer»
/ operator% operator
This is called division operator.This is called modulus operator.
This operator calculates quotient of two nos.
e.g. : int x = 10; y = 5, z;
z = x/y;
value of z will be 2.
/ can operate on integer as well as real nos.
This operator calculates remainder of two nos.
int x = 10„ y = 5, z;
z = x % y;
value of z will be 0.
% can operate on integer only.



Discussion

No Comment Found

Related InterviewSolutions