AtegonA to Programmer Humor · 1 year agoHow to detect if a number is evenimagemessage-square18fedilinkarrow-up169arrow-down13
arrow-up166arrow-down1imageHow to detect if a number is evenAtegonA to Programmer Humor · 1 year agomessage-square18fedilink
minus-squaremamarguerat@discuss.tchncs.delinkfedilinkarrow-up3·1 year agoprivate void GenerateCode(){ println("private bool IsEven(int number){"); println("if (number == 1) return false"); for(int i == 2; true; i += 2){ println("if (number == " + i.tostring() + " return true"; println("if (number == " + (i + 1).tostring() + " return false"; } }
private void GenerateCode(){ println("private bool IsEven(int number){"); println("if (number == 1) return false"); for(int i == 2; true; i += 2){ println("if (number == " + i.tostring() + " return true"; println("if (number == " + (i + 1).tostring() + " return false"; } }