mercredi 2 novembre 2016

c - optimizing repetitive if else

I have the following code:

if (a1 < a2)
   a3=0;
else
   a3=a1-a2;

if (b1 < b2)
   b3=0;
else
   b3=b1-b2;

if (c1 < c2)
   c3=0;
else
   c3=c1-c2;

The code is quite repetitive. Any suggestions on optimizing it? I do not want to use array.

Aucun commentaire:

Enregistrer un commentaire