Code is copied!
Program To Print Lead Number JAVA
Write a Program to print whether the inputted number is Lead or not.
[In a given number if the sum of even digits is equal to the sum of odd digits such numbers are called lead numbers.]
import java.util.*; class leadnumber { public static void main(String args[]) { Scanner sc = new Scanner (System.in); int n = sc.nextInt(); int sum_even=0,sum_odd=0; while (n>0) { int d = n % 10; if(d%2==0) { sum_even=sum_even+d; } else { sum_odd=sum_odd+d; } n=n/10; } if(sum_even==sum_odd) { System.out.println("It is a lead number"); } else { System.out.println("It is not a lead number"); } } }