Total Surface Area of Hemisphere || Functions in C++ || parametric functions || 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:-

#include<iostream.h>
#include<conio.h>

float calculate_area(float p, float r)
{
    float area;
    area = 3 * p * r * r;
    cout << "The Area of the Hemi-sphere with radius " << r << " is = " << area;
}

void main()
{
    clrscr();
    float radius, pi = 3.142;
    cout << "\nEnter the radius of the Hemi-sphere\n";
    cin >> radius;

    calculate_area(pi, radius);
    getch();
}
	
    
The code given below can be used for g++/gcc Compiler:-

#include<iostream>
using namespace std;

float calculate_area(float p, float r)
{
    float area;
    area = 3 * p * r * r;
    cout << "The Area of the Hemi-sphere with radius " << r << " is = " << area;
}

int main()
{
    float radius, pi = 3.142;
    cout << "\nEnter the radius of the Hemi-sphere\n";
    cin >> radius;

    calculate_area(pi, radius);
    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