CPS 125 Lecture Notes - Lecture 1: Scanf Format String
Document Summary
If, else, and switch statements if else example #1: #include int main(void) int x,y; scanf( %d ,&x); scanf( %d ,&y);; if(x>10) y++; else. User input integer value to be assigned to the variable x". User input integer value to be assigned to the variable y". If the value entered for the variable x" is less than 10: the new value of y" is the entered value of y" plus 1. If this condition is not satis ed (ie. x" is not less than 10), do not add 1 to y" (skip the command) and continue down the program. if(x>=15) y - -; else. If the value entered for x" is greater than or equal to 15; the new value of y" is the entered value of y" minus 1. If this condition is not met, skip the command of subtracting 1 from y" and continue down the program. if(x<10) x++; else.