Computer Science, asked by chandrushekarrocks28, 7 months ago

if(num % 5 == 0) Why does = is used Twice ?​

Answers

Answered by ArpitMishra506
2

Because if ' = ' means that ' the first value is equal to the second value '

And ' == ' means that you are asking that ' is the first value equal to the second value? '

Example :-

int a = 6;

a = 5;

Result :- value of a will be 5

int a = 6;

a == 5;

Result :- the statement will return false because the value of a i.e. 6 is not 5

int a = 6;

a == 6;

Result :- the statement will return true because the value of a i.e. 6 is 6.

In your question you are asking that ' if the value of the variable num is divided by 5, will it's answer be equal to 0 or not '

.

.

.

.

HOPE THIS HELPS YOU

.

.

.

.

PLEASE MARK AS BRAINLIEST AND FOLLOW ME TOO

Answered by anindyaadhikari13
1

Question:-

if(num%5==0)

In the given code, why = is used twice?

Answer:-

== operator is used to check equality of two numbers or characters. == is a comparison operator which is used to compare two values. It returns true if both values are equal.

In this program, the user checks if the remainder obtained when num is divided by 5 is equal to 0 or not.

Similar questions