Function ODD EVEN

Problem From: 101cproblems

#include<stdio.h>

int func(int a)
{
    if(a%2==0)
        return 1;
    return 0;
}


int main()
{
    int status,a;
    while(scanf("%d",&a)!=EOF)
    {
        status=func(a);
        if(status==1)
            printf("EVEN\n");
        else
            printf("ODD\n");
    }
    return 0;
}

Another:

#include<stdio.h>
void func();

int main()
{
    func();
    return 0;
}

void func()
{
    int a;
    while((scanf("%d",&a))!=EOF)
    {
        if(a%2==0)
        {
            printf("EVEN\n");
        }
        else
        {
            printf("ODD\n");
        }
    }
}

 

It would be a great help, if you support by sharing :)
Author: zakilive

Leave a Reply

Your email address will not be published. Required fields are marked *