Advertisement
hamaXD

function_odd_even

Oct 20th, 2016
82
0
Never
Not a member of Pastebin yet? Sign Up, it unlocks many cool features!
C 0.60 KB | None | 0 0
  1. //function_odd_even
  2. #include<stdio.h>
  3. void odd_even(int x);
  4. int odd_even2(int y);
  5. int main()
  6. {
  7.     int num,a;
  8.     while(1){
  9.         printf("Enter number :");
  10.         scanf("%d",&num);
  11.         odd_even(num);
  12.         a=odd_even2(num);
  13.         if(a==1){
  14.             printf("%d it is even(main)\n",num);
  15.         }
  16.         else{
  17.             printf("%d it is odd(main)\n",num);
  18.         }
  19.     }
  20.     return 0;
  21. }
  22.  
  23. void odd_even(int x)
  24. {
  25.     if(x%2==0){
  26.         printf("%d it is even\n",x);
  27.     }
  28.     else{
  29.         printf("%d it is odd\n",x);
  30.     }
  31. }
  32. int odd_even2(int y)
  33. {
  34.     int a=0;
  35.     if(y%2==0){
  36.         //a=1;//even
  37.         return 1;//
  38.     }
  39.     else{
  40.         //a=0;//odd
  41.         return 0;//
  42.     }
  43.     //return a;
  44. }
Advertisement
Add Comment
Please, Sign In to add comment
Advertisement