Computer Science, asked by sagarrc1564, 5 months ago

Explain the use of % (modulas)
operator and ==
operator with example​

Answers

Answered by Imblank
1

Answer:

% modulus operator print the remainder of division of 2 numbers Example = 15%4 = 3

Cause 4×3 = 12

15-12 = 3

== is a comparison operator which compare the values of two terms whether they are true or false

Read my bio once

Answered by anindyaadhikari13
1

Question:-

  • Explain the use of % operator and == operator with example.

Explanation:-

Modulo Operator:-

The % operator is used for calculating the remainder obtained after division of two numbers.

For example, consider two numbers,say 8 and 9

When 8 is divided by 9, we obtain the remainder as 8

So,

8%9=8

Again, if the numbers are 4 and 2.

So,

4%2=0 as 4 divided by 2 leaves remainder 0.

For negative numbers, say -5 and 2.

-5%2=-1(negative) you can notice this while finding the remainder.

== Operator:-

The ==(equals to) operator is used to check whether two numbers or characters are equal or not.

For example, say 5 and 10

5==10 is false as 5 is not equal to 10

But, 5==5 is true as 5 is equal to 5.

Similar questions