write a program in Java to print the sum of Even and Odd digits of a number
Answers
Answered by
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
Math,
6 months ago
Business Studies,
6 months ago
Computer Science,
1 year ago
English,
1 year ago
Chemistry,
1 year ago