/* File: if_logical_1.c * Name: D. Sheets * Username: dsheets * Date: 02/27/12 * Description: An example of using if with logical operators */ #include int main(void) { /* Get some input from the user */ int var1; int var2; printf("Input two positive integers seperated by a space:"); scanf("%d %d", &var1, &var2); /* Check if either of the values are negative */ if (var1 < 0 || var2 < 0) { printf("I said to give me positivie integers\n"); } /* Check if both values are negative */ if (var1 < 0 && var2 < 0) { printf("Two negative values? Now you're just being spiteful\n"); } else { printf("Thanks!\n"); } return(0); }