80.7k views
1 vote
Write a complete program that declares an integer variable, reads a value from the keyboard into that variable, and writes a single line to standard output consisting of the variable's value, twice the value, and the square of the value, separated by single spaces. Besides the numbers, nothing else should be in the line written to standard output except for the spaces separating the values.

1 Answer

5 votes

// making the variable

int variable = 0;

// input variable

cout << "Enter the value of variable : " <<endl;

cin>>variable;

// statement for out put

cout << " Value is : " << variable << "," <<"Twice value is : "<< 2(variable) <<","<<"Sqaure is " << variable * variable <<"."<<endl;

User Renato Dinhani
by
5.1k points