C++ Program to Calculate Square of a Number

C++ Program to Calculate Square of a Number

How to Calculate Square of a Number? We can do it by Multiplying the Number with itself OR by Powering it by 2.

Square of a Number by C++ :



#include <iostream>
using namespace std;

int main() 
{
    int number, sqr;
    
    cout << "Please Enter any Numeric Value : ";
    cin >> number;
    
    sqr = number * number;

    cout << "The Square of the Given Number " << number << " is = " << sqr;

    return 0;
}


Output :