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
-5
Newbie Poster

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?

Jump to PostMost 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 …

twomers
408
Posting Virtuoso

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.

mvmalderen
2,072
Postaholic

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

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

Edited
by mvmalderen because:
*
n/a *

gerard4143
371
Nearly a Posting Maven

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 %

shuva
0
Newbie Poster

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.