Addition of Two Numbers || 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:-

// add program
#include<iostream.h>
#include<conio.h>
void addition(int a, int b)
{
  int add;
  add = a + b;
  cout<<add;
}

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

// add program
#include<iostream>
using namespace std;
void addition(int a, int b)
{
  int add;
  add = a + b;
  cout<<add;
}

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