is this program is correct please can anyone tell me it is very urgent I have to submit this copy tomorrow and I have to show this to my sir now
Attachments:
Answers
Answered by
1
//TO PRINT THE SUM OF THE EVEN DIGITS OF A NUMBER STORED
class demo
{
public static void main(Stringarg[])
{
int n = 125;
int d,s=0;
while(n>0)
{
d=n%10;
if(d%2==0)
{
s=s+d;
}
n=n/10;
}
System.out.println(s + "is the sum of the even digits of the number");
}
}
Similar questions