Program to find area and circumference using function.
// Program to find area and circumference using function
#include <stdio.h>
float Area(int);
float Circ(int);
int main()
{
int r;
float area, circ;
printf("Enter the radius of a circle : ");
scanf("%d", &r);
area = Area(r);
circ = Circ(r);
printf("The area of the circle is : %.2f", area);
printf("\nThe circumference of the circle is : %.2f", circ);
return 0;
}
float Area(int r)
{
float area = 3.141 * r * r;
return area;
}
float Circ(int r)
{
float circ = 2 * 3.141 * r;
return circ;
}
Output :
Enter the radius of a circle : 5
The area of the circle is : 78.53
The circumference of the circle is : 31.41
No comments:
Post a Comment