Square Root of a Number || Functions in C++ || parametric function || C++
In this, we are going to see Functions, the program is based on function which Calculates, Profit or Loss.

The code given below can be used for TURBO C++ Compiler:-

// square root
#include<iostream.h>
#include<conio.h>
#include<math.h>
void squareroot(int a)
{
  int root;
  root = sqrt(a) ;
  cout<<root;
}

void main()
{
  clrscr();
  int num1;
  cout<<"Enter numbers";
  cin>>num1;
  squareroot(num1);
  getch();
}
	
    
The code given below can be used for g++/gcc Compiler:-

// square root
#include<iostream>
#include<math.h>
using namespace std;
void squareroot(int a)
{
  int root;
  root = sqrt(a) ;
  cout<<root;
}

int main()
{
  int num1;
  cout<<"Enter numbers";
  cin>>num1;
  squareroot(num1);
  return 0;
}
	
    
#ENJOY CODING

Post a Comment

FOR ANY DOUBTS AND ERRORS FEEL FREE TO ASK. YOUR DOUBTS WILL BE ADDRESSED ASAP

Previous Post Next Post