fork download
  1. #include <stdio.h>
  2.  
  3. int main (){
  4. int n,digit,sum=0;
  5. scanf("%d",&n);
  6. while(n!=0)
  7. {
  8. digit =n%10;
  9. if(digit%2==0)
  10. {
  11. sum=sum +digit;
  12. }
  13. n=n/10;
  14. }
  15. printf("sum of even digits=%d\n",sum);
  16.  
  17. return 0;
  18. }
Success #stdin #stdout 0s 5324KB
stdin
Standard input is empty
stdout
sum of even digits=14