Advertisement
RAJIBRAJU

3.even odd in function

Jul 5th, 2019
112
0
Never
Not a member of Pastebin yet? Sign Up, it unlocks many cool features!
C 0.36 KB | None | 0 0
  1. #include <stdio.h>
  2. int evenodd(int n)
  3. {
  4.     if (n%2==0)
  5.     {
  6.         return 1 ;
  7.     }
  8.  
  9.  
  10.     else
  11.     {
  12.  
  13.  
  14.         return 2;
  15.     }
  16. }
  17.  
  18.  
  19. int main()
  20. {
  21.     int n,ans,even,odd;
  22.     scanf("%d",&n);
  23.     ans= evenodd(n);
  24.     if (ans==1)
  25.     {
  26.         printf("even");
  27.     }
  28.     else if (ans==2)
  29.     {
  30.         printf("odd");
  31.     }
  32.  
  33.     return 0;
  34. }
Advertisement
Add Comment
Please, Sign In to add comment
Advertisement