Java program to add two number without using plus operator

preview_player
Показать описание
Java program to add two number without using addition operator.
Here ~ is a complement operator.
So, a - ~b -1 is equivalent to
= a-(-b + 1) + 1+
= a + b – 1 + 1
= a + b
Рекомендации по теме
Комментарии
Автор

A really elegant solution, thank you.

MrSupermonkeybox
Автор

sir could you please explain this (sum=a-~b-1) what is the purpose of this ~ symbol

manikandanbalasubramani
Автор

Plz upload on all arithmetic operators

vinothvk
join shbcf.ru