DOUBT ON USE OF A SYMBOL

WHY WAS != USED NOT == . I AM NOT UNDERSTANDING THE DIFFERENCE

The not-equal-to operator ( != ) returns true if the operands don’t have the same value; otherwise, it returns false.
The equal-to operator ( == ) returns true if both operands have the same value; otherwise, it returns false
so here we have to continue the loop till remainder is not 0

1 Like

I am not still sure . please clear my confusion.
we want to run the process in while loop to get HCF and so process should be continued till we get remainder as zero.
so why we use while(dividend%divisor!=0)
and not while(dividend%divisor==0)
doesn’t first statement mean carry out the loop till remainder is not zero
and second statement mean carry out loop till remainder is zero
and we want to carry out loop till we get remainder as zero
please correct me

this means carry out while the remainder is zero .so this ll only run when remainder is 0 .what we want to do is start with a value and go till remainder isnt 0

1 Like