mercredi 17 août 2016

How to create logic in if else condition

How to write the following condition using single if else?

int a;  //a can vary from 8 to 12
int b = 10

**a** is equal to **b**
**a** is less than **b** by the margin of 2
**a** is greater than **b** by the margin of 2

In all above cases the if condition should be met. If margin is greater than 2, go to else condtion

Aucun commentaire:

Enregistrer un commentaire