HEY I JUST NEED TO PUT THE FOLLOWING:

IF((N == 2) && (T CAN'T BE DIVIDED BY 4))

how can I put: CAN'T BE DIVIDED BY 4?

I know divided by 4 is : (t / 4).

but can not be divided by 4?

Recommended Answers

All 4 Replies

Most things can be divided. Do you mean is divided with no remainder?
The modulus operator is your friend here.

for ( i=0; i<10; i++ ) {
  printf( "%d mod 4 = ", i, i%4 );
}

It returns 0 if no remainder would be returned on division.

>how can I put: CAN'T BE DIVIDED BY 4?

if( (N == 2) && (T % 4) )
{
    /* Your code here */
}

HEY I JUST NEED TO PUT THE FOLLOWING:

IF((N == 2) && (T CAN'T BE DIVIDED BY 4))

how can I put: CAN'T BE DIVIDED BY 4?

I know divided by 4 is : (t / 4).

but can not be divided by 4?

Use the modulus operator %

If (N ==! 2) && (T/4)
{
//Code
}

Be a part of the DaniWeb community

We're a friendly, industry-focused community of developers, IT pros, digital marketers, and technology enthusiasts meeting, networking, learning, and sharing knowledge.