Advertisement
Md_hosen_zisad

evenoddfrom digit

Aug 28th, 2017
371
0
Never
Not a member of Pastebin yet? Sign Up, it unlocks many cool features!
C 0.27 KB | None | 0 0
  1. #include<stdio.h>
  2. int main()
  3. {
  4.     int a=0,N,r,a1=0;
  5.     printf("Enter input ::");
  6.     scanf("%d",&N);
  7.     while(N!=0)
  8.     {
  9.      r=N%10;
  10.      N=N/10;
  11.     if(r%2==0)
  12.         a=a+r;
  13.     else
  14.         a1=a1+r;
  15.     }
  16.     printf("%d & %d",a,a1);
  17.  
  18.  
  19. return 0;
  20. }
Advertisement
Add Comment
Please, Sign In to add comment
Advertisement