Pages

Friday, July 05, 2013

Write a program to find Area of Ellipse in C++

Area of Ellipse Formula: pi * a * b

Source Code:

 1
 2
 3
 4
 5
 6
 7
 8
 9
10
11
12
13
14
15
16
17
    #include <iostream.h>
    #include <conio.h>
    int main()
    {   
    float A, a, b, pi;
    cout << "Area of Ellipse Formula: A = pi * a * b\n";
    cout << " Enter the value of a?\n";
    cin  >> a;
    cout << " Enter the value of b?\n";
    cin  >> b;
    a = a * b;
    pi= 3.1415;
    A = a * pi;
    cout << "\tArea of Ellipse = " << A << " m^2 " << endl;
    getch();
    return 0;
    }// end main

Output:

Area of Ellipse Formula: pi * a * b
 Enter the value of a?
34
 Enter the value of b?
66
 Area of Ellipse = 7040.53 m^2 

No comments:

Post a Comment