Function Programming : Even and Odd Number find using C

WAP using C-Function to check Odd Number and Even Number from a given input.

#include<stdio.h>
int evenodd(int a);
int main()
{
    int a;
    printf("\nEnter the number: ");
    scanf("%d",&a);
    evenodd(a);
}
int evenodd(int q)
{
if  (q%2 = = 0)
      printf("\nThis is a even number");
else if (q%2 = = 1)
      printf("\nThis is a odd number");
}

27 comments:

  1. #include
    int numcheck(int num);
    main()
    {
    int num;
    printf("Enter the number: ");
    scanf("%d",&num);
    numcheck(num);
    }
    int numcheck(int a)
    {
    if(a%2==0)
    printf("The number is even");
    else
    printf("The number is odd");
    }

    ReplyDelete
  2. #include
    main()
    {
    int m;
    printf("Enter your digit : ");
    scanf("%d",&m);
    number (m);
    }

    int number (int n)
    {
    if(n%2==0)
    printf("\neven number\n");
    else if(n%2==1)
    printf("\nnot even number\n");
    }

    ReplyDelete
  3. #include
    main()
    {
    int m;
    printf("Enter your digit : ");
    scanf("%d",&m);
    number (m);
    }

    int number (int n)
    {
    if(n%2==0)
    printf("\neven number\n");
    else if(n%2==1)
    printf("\nodd number\n");
    }

    ReplyDelete
  4. #include
    #include
    int check_even(int h);
    int main()
    {
    int k,result;
    printf("\n Enter number for check if it is even or not; ");
    scanf("%d",&k);
    result=check_even(k);
    getch();
    return 0;

    }

    int check_even(int c)
    {

    int i=2;
    if(c%i==0)
    printf("\n It is even number");
    else
    printf("\n It is odd number");
    getch();
    return i;
    }

    ReplyDelete
  5. #include
    #include
    int check_even(int);
    int main()
    {
    int n,result;
    printf("\n Enter number for check if it is even or not; ");
    scanf("%d",&n);
    result=check_even(n);
    getch();
    return 0;

    }

    int check_even(int a)
    {

    int i=2;
    if(a%i==0)
    printf("\n It is even number");
    else
    printf("\n It is odd number");
    getch();
    return i;
    }

    ReplyDelete
  6. Md. Rajib Sarker Id: 201320635December 12, 2013 at 10:20 PM

    #include
    main()
    {
    int m;
    printf("Enter your digit : ");
    scanf("%d",&m);
    number (m);
    }

    int number (int n)
    {
    if(n%2==0)
    printf("\neven number\n");
    else if(n%2==1)
    printf("\nnot even number\n");
    }

    ReplyDelete
  7. #include
    int evenodd(int a);
    main()
    {
    int a;
    printf("enter the number:");
    scanf("%d",&a);
    evenodd(a);
    getch();
    }
    int evenodd(int q)
    {
    if(q%2==0)
    printf("this is a even number");
    else if(q%2==1)
    printf("this is a odd number");
    }

    ReplyDelete
  8. #include
    int evenodd(int a);
    main()
    {
    int a;
    printf("enter the number:");
    scanf("%d",&a);
    evenodd(a);
    getch();
    }
    int evenodd(int q)
    {
    if(q%2==0)
    printf("this is a even number");
    else if(q%2==1)
    printf("this is a odd number");
    }

    ReplyDelete
  9. #include
    int main(){
    int num;
    printf("Enter an integer you want to check: ");
    scanf("%d",&num);
    if((num%2)==0) /* Checking whether remainder is 0 or not. */
    printf("%d is even.",num);
    else
    printf("%d is odd.",num);
    return 0;
    }

    ReplyDelete
  10. #include

    int checkOddEven(int n)
    {
    if(n%2==0)
    {
    printf("%d is a even number.\n", n);
    }
    else if(n%2==1)
    {
    printf("%d is a odd number.\n", n);
    }
    }

    void main()
    {
    int n;
    printf("Enter a number : ");
    scanf("%d",&n);
    checkOddEven (n);
    }

    ReplyDelete
  11. #include
    using namespace std;
    int even_odd(int x)
    {
    if(x%2==0)
    cout<<"the number is even";

    else
    cout<<"the number is odd";
    }
    main()
    {
    int a;
    cout<<"enter the number"<>a;
    cout<<' ';
    even_odd(a);
    }

    ReplyDelete
  12. ID:201210411
    #include
    using namespace std;
    int main ()
    {
    int number;
    cout<<"Enter number to check it is Even or odd: ";
    cin>>number;
    if(number%2==0)
    cout<<"Number is Even";
    else
    cout<<"Number is Odd";
    return 0;
    }

    ReplyDelete
  13. #include
    using namespace std;
    int evenodd(int i)
    {
    if(i%2==0)

    cout<<"Even number"<>num;
    evenodd(num);
    }

    ReplyDelete
  14. Id-201210803

    #include
    using namespace std;
    int odd_even(int value)
    {
    if (value %2 == 0 )
    cout << "The number is Even.";
    else
    cout << "The number is Odd.";
    cout << "\n\n";

    }
    main()
    {
    int number=0;

    cout << "Enter a Number : ";
    cin >> number;
    odd_even(number);
    }

    ReplyDelete
  15. #‎include‬
    using namespace std;
    void oddeven(int a)
    {
    if(a%2==0)
    cout << "It is a even number." <> b;
    oddeven(b);
    }

    ReplyDelete
  16. #include
    main()
    {
    int m;
    printf("Enter your digit : ");
    scanf("%d",&m);
    number (m);
    }

    int number (int n)
    {
    if(n%2==0)
    printf("\neven number\n");
    else if(n%2==1)
    printf("\nnot even number\n");
    }

    ReplyDelete
  17. #include
    using namespace std;
    class evod
    {
    public:
    int n;
    evod();
    void show();
    ~evod()
    {

    }

    };
    evod::evod()
    {
    cout<<"Input Number To check even or odd: ";
    cin>>n;
    }
    void evod::show()
    {
    if(n%2==0)
    cout<<"THis is Even Number";
    else
    cout<<"This is Odd Number";
    }
    int main()
    {
    evod appel;
    appel.show();
    }

    ReplyDelete
  18. #include
    using namespace std;
    class cheak
    {
    public:
    int num;
    cheak();
    void show();
    ~cheak();
    };
    cheak::cheak()
    {

    cout<<"Enter a number: ";
    cin>>num;
    cout<<endl;
    }
    void cheak::show()
    {
    if(num%2==0)
    cout<<"EVEN"<<endl;
    else
    cout<<"ODD"<<endl;
    }
    cheak::~cheak()
    {

    }
    int main()
    {
    cheak obj;
    obj.show();
    return 0;
    }

    ReplyDelete
  19. #include
    using namespace std;

    class check_odd_or_even
    {
    public:
    int num;
    check_odd_or_even();
    void show();
    };

    check_odd_or_even::check_odd_or_even()
    {
    cout<<"Enter a number: ";
    cin>>num;
    }
    void check_odd_or_even::show()
    {
    int i;
    if(num%2==0)
    cout<<endl<<num<<" is even.";
    else
    cout<<endl<<num<<" is odd.";
    }
    main()
    {
    check_odd_or_even ob1,ob2;
    ob1.show();
    ob2.show();
    }

    ReplyDelete
  20. using C++

    #include
    using namespace std;

    class cons
    {
    public:
    int num;
    cons(int i);
    ~cons();

    void result();
    };

    cons::cons(int i)
    {
    num = i;
    }
    void cons::result()
    {
    if (num == 0)
    cout << "Enter correct number --: \n";
    else if (num % 2 == 0)
    cout << num << " Is a even number --\n" ;
    else
    cout << num << " Is a odd number --\n";
    }

    cons::~cons()
    {
    cout << "[+]MEMORY RELEASED[+]\n";
    }

    int main()
    {
    int i;
    cout << "Eneter that number you want to check --: ";
    cin >> i;

    cons obj(i);
    obj.result();

    return 0;
    }

    ReplyDelete
  21. #include
    using namespace std;
    class cheak
    {
    public:
    int n;
    cheak();
    void show();
    ~cheak();
    };
    cheak::cheak()
    {
    cout<<"Enter a number:";
    cin>>n;
    }
    void cheak::show()
    {
    if(n%2==0)
    cout<<"Even"<<endl;
    else
    cout<<"odd"<<endl;

    }
    cheak::~cheak()
    {

    }
    int main()
    {
    cheak obj;
    obj.show();
    return 0;
    }

    ReplyDelete
  22. using constructor
    mamun ur rashid
    #include
    using namespace std;
    class OEN
    {
    public:
    int p;
    OEN();

    ~OEN();
    void result();
    };
    OEN::OEN()
    {
    cout<<"Enter a number :" ;
    cin>>p;
    }
    OEN::~OEN()
    {

    }
    void OEN::result()
    {
    if(p%2==0)
    cout<<"This is even nimber :";

    else if(p%2==1)
    cout<<"This is odd number:";
    }
    int main()
    {
    OEN sb;
    sb.result();
    }

    ReplyDelete
  23. #include
    using namespace std;
    class even_odd
    {
    public:
    int a;
    even_odd();
    ~even_odd();
    void result();
    };
    even_odd::even_odd()
    {
    cout<<"Enter the number to check even or odd :" <>a;
    }
    even_odd::~even_odd()
    {

    }
    void even_odd::result()
    {
    if(a%2==0)
    cout<<"This is a even nimber :";

    else if(a%2==1)
    cout<<"This is a odd number:";
    }
    int main()
    {
    even_odd ob;
    ob.result();
    }

    ReplyDelete
  24. #include
    using namespace std;

    class check
    {
    public:
    int num,sum=0;
    check();
    ~check()
    {
    cout<<"Distructor active";
    }
    int func()
    {
    if(num%2==0)
    cout<<"This number is even"<>num;
    }

    int main()
    {
    check obj;
    obj.func();
    return 0;
    }

    id:201510660

    ReplyDelete
  25. #include
    using namespace std;

    class check
    {
    public:
    int num;
    check();
    ~check()
    {
    cout<<"Distructor active";
    }
    int setu()
    {
    if(num%2==0)
    cout<<"This number is even"<>num;
    }

    int main()
    {
    check obj;
    obj.setu();
    return 0;
    }

    id:201510992

    ReplyDelete
  26. using c++

    #include
    using namespace std;

    class cons
    {
    public:
    int num;
    cons(int i);
    ~cons();

    void result();
    };

    cons::cons(int i)
    {
    num = i;
    }
    void cons::result()
    {
    if (num == 0)
    cout << "Enter correct number --: \n";
    else if (num % 2 == 0)
    cout << num << " Is a even number --\n" ;
    else
    cout << num << " Is a odd number --\n";
    }

    cons::~cons()
    {
    cout << "[+]MEMORY RELEASED[+]\n";
    }

    int main()
    {
    int i;
    cout << "Eneter that number you want to check --: ";
    cin >> i;

    cons obj(i);
    obj.result();

    return 0;
    }

    ReplyDelete