Area of Circle using function

for formula: http://www.mathsisfun.com/area.htm

code:

#include<stdio.h>
double pi=3.1416;
double britto(double r)
{
    double area=pi*r*r;
    return area;
 
}
int main()
{
double r=3;
double khetrofol=britto(r);
printf("%lf",khetrofol);
 
    return 0;
}

We have to always remember that value that define is always pass from main function to customized function named by user so here r=3 is passing to function britto and then the britto formula pi*r*r is applying and returned the value and it is printed in the main function where the variable defined as khetrofol.

Here pi declared as global variable with it’s value.

It would be a great help, if you support by sharing :)
Author: zakilive

Leave a Reply

Your email address will not be published.