Code goes like this :
/* Program for calculating area of ellipse */
#include<stdio.h>
#define PI 3.1415
float area_of_ellipse(float a, float b);
main()
{
float major,minor, area;
printf("\n Enter major and minor axis of area :");
scanf("%f %f",&major, &minor);
area=area_of_ellipse(major, minor);
printf("\n The area of ellipse is %.3f",area);
} // end of main function
float area_of_ellipse(float a, float b)
{
return PI*a*b;
}
Output:
I have used Dev CPP to compile this program. If you are using Turbo C++ IDE, then use conio.h in link section after stdio.h and use getch(); to hold the output screen, just before the end of main function.
If you have any confusion regarding the program, please, comment below.
Home / Area of Ellipse /
C Language /
C Programming /
Function
/ Area of Ellipse using function: C Programming
- Blogger Comment
- Facebook Comment
Subscribe to:
Post Comments
(
Atom
)
0 comments:
Post a Comment