Lead Number

Lead Number is a number whose sum of even digits is equal to the sum of odd digits.

Example 1: 143. Sum of even digits = 4 = 1+3 = Sum of odd digits. Hence it is a Lead Number.

Example 2: 234. Sum of even digits = 2+4 ≠ 3 = Sum of odd digits. hence it is not a Lead Number.

Java
import java.util.*;
public class LeadNumber
{
    public static void main(String args[])
    {
        int n=0,r=0,oSum=0,eSum=0,nCopy=0;
        Scanner sc=new Scanner(System.in);
        System.out.print("Enter a number: ");
        n=sc.nextInt();
        nCopy=n;
        while(n>0)
        {
            r=n%10;
            if(r%2==0)
            {
                eSum=eSum+r;
            }
            else
            {
                oSum=oSum+r;
            }
            n=n/10;
        }
        if(eSum==oSum)
        {
            System.out.println(nCopy+" is a Lead Number");
        }
        else
        {
            System.out.println(nCopy+" is not a Lead Number");
        }
    }
}
Java