Computer Science, asked by shailendrakumar491, 8 months ago

write a program in Java to print the sum of Even and Odd digits of a number​

Answers

Answered by kingcobra1
1

Answer:

public class evenodd

{

public static void main(int a)

int i;int s1=0;ints2=0;

for(i=a;i>=0;i=i/10)

{

int b=i%10;

if(b%2==0)

{

s1++;

}

else

{

s2++;

}

}

System.out.println(s1);

System.out.println(s2);

}

}

Similar questions