C program to find area of circle using function

If you are using any software then below program will not give an error, but if you are using TURBO C then you have to make some changes like: void main() and some function like clrscr() or getch().



#include<stdio.h>
main()
{
 void area_of_circle(float);
 float r;
 printf("Enter radius of circle\n");
 scanf("%f",&r);
 area_of_circle(r);
}
void area_of_circle(float r)
{
 float area;
 area=3.14*r*r;
 printf("Area of circle = %5.2f",area);
}

OUTPUT:

Enter radius of circle
5
Area of circle = 78.50

Leave a Reply

Your email address will not be published. Required fields are marked *

9 + nine =

This site uses Akismet to reduce spam. Learn how your comment data is processed.