c sharp if int is even code example Example: c# if int is even int i = 5; if (i % 2 == 0) { // even } else { // odd }