Print square of any number by function (input in the user define function)

# include <iostream>
using namespace std;


int sq() // name of function      
{
  
 int number;
    cout<<"Please enter the number: "; // message for user
    cin>>number;

    int sq; // variable
    sq=number*number; // formula for square
    return sq; // the value return from a variable sq

}

void main ()

{

int ans=sq(); // here the function call

cout<<"The square is: "ans<<endl<<endl;

}

Comments

Popular posts from this blog

Umbrella activities in Software Engineering

Operating System | Best Definition of Opetating System