# include # include using namespace std; int main ( ) // // FORMULA.CPP // // This program shows how three variables, X, Y and Z can be declared, // but // // X is given a value in the declaration statement, // Y is given a value by user input, // Z is given a value by an assignment statement using a formula // based on the values of X and Y. // { int x = 12; int y; int z; cout << "Enter the value of y: "; cin >> y; z = x + 42 * y; cout << "x = " << x << "\n"; cout << "y = " << y << "\n"; cout << "z = " << z << " = " << x << " + 42 * " << y << "\n"; }