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.
C
#include <stdio.h>
int main()
{
int n=0,r=0,oSum=0,eSum=0,nCopy=0;
printf("Enter a number: ");
scanf("%d", &n);
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)
{
printf("%d is a Lead Number",nCopy);
}
else
{
printf("%d is not a Lead Number",nCopy);
}
return 0;
}C