private static int fun(int m) { int temp = 0; for (int i = 1; i <= m; i++) { if (i % 2 == 1) temp = temp + i; else temp = temp - i; } return temp; }
private static int fun(int m) { int temp = 0; for (int i = 1; i <= m; i++) { if (i % 2 == 1) temp = temp + i; else temp = temp - i; } return temp; }