/*********************************************************** guess.ch Introduction to Ch This program introduces how to use conditional statements so that programs run differently under different circumstances. The program will run only the first if statement that it encounters. ************************************************************ Copyright 2014 SoftIntegration Inc. http://www.softintegration.com Licensed under the Apache License, Version 2.0 (the "License"); you may not use this file except in compliance with the License. You may obtain a copy of the License at http://www.apache.org/licenses/LICENSE-2.0 ***********************************************************/ // initialize variables int guess; // ask user for a guess printf("Guess the average number of texts an American teen sends and receives each month: "); scanf("%d", &guess); // if the guess is equal to 2272 run this portion... if (guess == 2272) printf("You got it!\n"); // else if the guess less than 2272 run this portion... else if (guess < 2272) printf("Too low; the average American teen sends 2272 texts per month\n"); // if it does not satisfy any of the above conditions, run this portion... else printf("Too high; the average American teen sends 2272 texts per month\n");