Hello everyone, it seems like there’s probably a equation to make this more efficient, but I’m not the math whiz that many others may be.
Is there a simpler way to do this?:
switch (num) {
case 1: pn = 0; break;
case 2: pn = 2; break;
case 3: pn = 4; break;
case 4: pn = 6; break;
case 5: pn = 8; break;
case 6: pn = 10; break;
case 7: pn = 12; break;
case 8: pn = 14; break;
case 9: pn = 16; break;
case 10: pn = 18; break;
case 11: pn = 20; break;
//and it keeps going.....
}
In words what’s happening is that for every incremental number it goes to the next even number to process.
Any help would be greatly appreciated.