90 225
Assignments Done
99.4%
Successfully Done
In September 2020

# Answer to Question #27169 in Java | JSP | JSF for Disebo Mosala

Question #27169
(1) A=Pi*r^2
(2) C=n!/r!(n-r)!
1
2013-03-27T08:55:03-0400
package question.t27169;

public class Test
{
publicstatic void main(String[] args)
{
System.out.println(t1(10));
System.out.println(t2(2,3));
}

/**
* (1) A=Pi*r^2 - formula for the area of acircle
*
* @param r - radius of the circle
* @return
*/
publicstatic double t1(double r)
{
returnMath.PI*r*r;
}

/**
* (2) C=n!/r!(n-r)! - combination Inmathematics a combination is a way of
* selecting several things out of a largergroup, where (unlike
* permutations) order does not matter.
*
* @param r
* @param n
* @return
*/
publicstatic int t2(int r,int n)
{
returnfact(n)/(fact(r)*fact(n-r));
}
/**
* factorial calculation
* @param n
* @return
*/
publicstatic int fact(int n)
{
if(n<1)
{
return1;
}
else
{
returnn*fact(n-1);
}
}

}

Need a fast expert's response?

Submit order

and get a quick answer at the best price

for any assignment or question with DETAILED EXPLANATIONS!