Create a function named square that takes one integer number as a parameter and returns the square of that number. Then, call that function in the main () bypassing any value, and displaying the result.

Sample Input:

Please enter a number: 5

Sample Output:

The square of the entered number is: 25   

cpp programming exercise with solution
cpp programming exercise with solution


#include <iostream>
using namespace std;

void square(int number)
{
cout<<"The square of entered number is: "<<number*number;
}
int main(){
int number;
cout<<"Please enter a number: ";
cin>>number;
square(number);
return 0;
}