Welcome

Hi! This blog is for beginners of c++ and java .You can check and pick codes for your programming assignments. This will also help you to understand the concepts of these programming languages. Its all about programming.

Even , Odd , Positive and Negative(By Arrays)

Tuesday, June 7, 2011

#include <iostream.h>
void e_o(int x[]);
void p_n(int y[]);
int main()
{
    int a[10];
    for (int b=0;b<10;b++)
    {
        cout <<"Enter Number " << b << ": ";
        cin>>a[b];
        cout <<endl;
    }
    e_o(a);
    p_n(a);
    return 0;
}
void e_o(int x[])
{
    for (int a=0;a<10;a++)
    {
        if (x[a]%2==0)
        {
            cout <<x[a]<<" is Even "<<endl;
        }
        else
        {
            cout <<x[a]<<" is Odd "<<endl;
        }
    }
    return;
}
void p_n(int x[])
{
    for (int a=0;a<10;a++)
    {
        if (x[a]<0)
        {
            cout <<x[a]<<" is Negetive "<<endl;
        }
        else
        {
            cout <<x[a]<<" is Positive "<<endl;
        }
    }
    return;


}