Ticker

6/recent/ticker-posts

Header Ads Widget

Responsive Advertisement

Area of Circle using C

Problem Statement

Given a radius ‘r’, your job is to find the area of a circle in C programming language.


#include

#define pi 3.14

float area(float r)

{

  float ar=pi*r*r;

  return ar;

}

int main()

{

  float r;

  printf("Enter the radius : ");

  scanf("%f",&r);

  float res=area(r);

  printf("%f",res);

  return 0;

}

Output

Enter the radius : 5

78.500000 

Explanation 

Area of circle : pi * r * r.

Post a Comment

0 Comments