Determine if a value is positive or negative

/*
C#: The Complete Reference
by Herbert Schildt
Publisher: Osborne/McGraw-Hill (March 8, 2002)
ISBN: 0072134852
*/
// Determine if a value is positive or negative.
using System;
public class PosNeg {
public static void Main() {
int i;
for(i=-5; i <= 5; i++) {
Console.Write("Testing " + i + ": ");
if(i < 0) Console.WriteLine("negative");
else Console.WriteLine("positive");
}
}
}
Related examples in the same category