Saturday, 5 July 2014

C++ program to find square of number using inline function


Here is a C++ program to find square of number using inline function


 SOURCE CODE OUTPUT
#include<iostream>
using namespace std;
inline int sqr(int x)
{
    return x*x;
}
int main()
{
    int x;
    cout<<"Enter number : ";
    cin>>x;
    cout<<"Square of number : "<<sqr(x);
    return 0;
}

Any questions regarding to program please write in comments.

1 comment: