We first take a number. We then find the binary equivalent of this number and store it into another variable. We find the total number of ones in the binary number. If we found an even number of ones in the binary equivalent number, then the number is an evil number.