954,498 Members — Technology Publication meets Social Media
Username:
Password:
Lost login information?
Have something to say? Contribute New Article Reply to this Article

NEED help TO PUT THE FOLLOWING: IF((N == 2) && (T CAN'T BE DIVIDED BY 4))

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?

needhelpe
Newbie Poster
22 posts since Oct 2009
Reputation Points: 5
Solved Threads: 0
 

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.

twomers
Posting Virtuoso
1,877 posts since May 2007
Reputation Points: 453
Solved Threads: 57
 

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

if( (N == 2) && (T % 4) )
{
    /* Your code here */
}
tux4life
Nearly a Posting Maven
2,350 posts since Feb 2009
Reputation Points: 2,134
Solved Threads: 243
 

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 %

gerard4143
Nearly a Posting Maven
2,272 posts since Jan 2008
Reputation Points: 512
Solved Threads: 387
 

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

shuva
Newbie Poster
1 post since Oct 2009
Reputation Points: 10
Solved Threads: 0
 

This article has been dead for over three months

Post: Markdown Syntax: Formatting Help
You