Home » C Program to Find the Area of a Circle Using Functions

C Program to Find the Area of a Circle Using Functions

Learn about C Program to Find the Area of a Circle Using Functions in the below code example. Also refer the comments in the code snippet to get a detailed view about what’s actually happening.

Contents

C Program to Find the Area of a Circle Using Functions

Program:

#include<stdio.h>

float circleArea(float r);

int main()
{
  float radius, area;

  printf("Enter the radius of the circle: ");
  scanf("%f", &radius);

  area = circleArea(radius);
  printf("Area of circle = %.2f\n",area);

  return 0;
}

// function
float circleArea(float r)
{
  float area = 3.14 * r * r;
  return area;
}

Output:

Enter the radius of the circle: 5
Area of circle = 78.50

Hope above code works for you and Refer the below Related Codes to gain more insights. Happy coding and come back again.

Similar Codes :
C Program to Find the Area of a Rectangle Using Functions
C Program to Print Inverse Diamond Pattern