Monday, April 25, 2016

Even or Odd (Void Function)


Implement a C code that take from the user integer number and print if that number is odd or even by using function method


Code 


 1
 2
 3
 4
 5
 6
 7
 8
 9
10
11
12
13
14
15
16
17
18
#include <stdio.h>
void evenorodd (int a ) {
    if (a%2 != 0 )
    printf("The entered number is odd\n");
else
    printf("The entered number is even\n");
 return ;
}


int main (){
    int x;

    printf("please enter an integer number\n ");
    scanf("%d",&x);
    evenorodd(x);
    return 0 ;
}


Output :



Share this

0 Comment to "Even or Odd (Void Function)"

Post a Comment