so here is my code
Code:
#include <stdio.h>
#include <stdlib.h>
#include <math.h>
int main()
{
double k,A,B,NumberOfSlices,Width,y,Area;
NumberOfSlices = 10.0;
Area = 0.0;
A = 10.0;
B = 6.0;
Width = A / NumberOfSlices;
while ( k < NumberOfSlices )
{
y = (B/A)*pow(A*A-(Width * ( k + 1 ) * Width * ( k + 1 ),(1.0/2.0));
Area = y * Width + Area;
k = k + 1;
}
printf("\n\t the area of the ellipse is %10.3f", Area * 4 );
printf("\n\n\n");
}
i cant get it to give me an answer other than 0.000
the real answer is 188.4955...but that is by pi * a * b in which a&b are where the ellipse touches the x&y respectively graph axis.
but i have to calculate using the formula of (x^2/a^2) + (y^2/b^2) = 1 and Area = y * width. please help me.