C Program To Find Number Is Even / Odd Using Pointer

int main()
{
    int array[10];
    int *arrayPtr = &array;
    int arrayEven[10];
    int *pEven = &arrayEven;
    int arrayOdd[10];
    int * pOdd = &arrayOdd;
    int i, j;
    for(i=0; i<10; i++)
        {
        array[i] =rand()%100 ;
        if(array[i] %2 ==0)
        {
            printf("%d\n", array[i]);
            printf("Even number");
        }
        else
        {
            printf("%d\n", array[i]);
            printf("Odd number");
        }
    }

Output:


		

Leave a Comment