Ruby program to find the 1's complement of the given number
num1 = 2
puts("1's complement of mum1 is: ",~num1)
num2 = 5
puts("1's complement of mum2 is: ",~num2)
Output:
1's complement of mum1 is:
-3
1's complement of mum2 is:
-6
