Even and Odd

Algorithm

Input An integer.  
Output Print number is even or odd.  
Complexity O(1)  
  
Even-odd(n)  
1 If (n%2=0) then  
2   Print number is even  
3 else  
4   Print number is odd  

Algorithm Description

Even-odd() function takes an integer and checks whether n is divisible by 2 or not.if its remainder is0 then number is even otherwise number is odd.

C Code

//To check wheather a number is even or odd
//Input : Any integer number

#include< stdio.h>
#include< conio.h>
int main()
{
    int num;
    printf("Enter a number ");
    scanf("%d",&num);
    if(num%2==0)
    printf("Number %d is Even",num);
    else
    printf("Number %d is Odd",num);
}