square 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 of number
#include<iostream.h>
#include<conio.h>
void square(int a)
{
  int sq;
  sq = a * a;
  cout<<sq;
}

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

// square of number
#include<iostream>
using namespace std;
void square(int a)
{
  int sq;
  sq = a * a;
  cout<<sq;
}

int main()
{
  int num1;
  cout<<"Enter numbers";
  cin>>num1;
  square(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