Hanny - Smith formula for calculating the percentage of ionic character is
% ionic character = 16(|xA−xB|)+3.5(xA−xB)2
where 'xA ' is the electronegativity of one element and xB is the electronegativity of the other element.
The first expression includes a modulus because we are interested in the difference in electronegativity.
Note: This gives the % ionic character. To calculate % covalent character, we have to do 1 - (% ionic character).