Area of Ellipse using function: C Programming

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.
Share on Google Plus

About Nepali Xoro

Interested in Information Technology, Spreading Knowledge for Nepalease IT Students."Loves Traveling", Listen Music and Surfing web.
    Blogger Comment
    Facebook Comment

0 comments:

Post a Comment