info@meritcampus.com    +91-85006-22255
...
`

Biggest Circle In Rectangle
What will be the output of the following program?
`public class BiggestCircleInRectangle {    public static void main(String[] args) {        int width = 7, height = width * 2;        int min = Math.min(width, height);        int area = width * height - 22 / 7 * min / 2 * min / 2;        System.out.print("area = " + area);    }}`

 A. area = 63 B. area = 59.5 C. Some other output D. Compilation Error because height can not be assigned to width * 2. E. Compilation Error for some other reason
Topic:

### User comments below.All of them might not be correct.

ans is 63..height=width*2 wil nt cause error..Math.min wil give the 7

Posted by Uday Kumar    2014-06-19 13:41:46

because in statement int area=width*height-22/7*min/2*min/2..
Java has same precedence order of both multiplication and division so strictly follows evaluates left operator first than right..
So 22/7=3
3*min=21
21/2=10
10*min=70
70/2=35
Therefore, 22/7*min/2*min/2=35
width-height-22/7*min/2*min/2=98-35=63
Therefore a=output is answer "a" 'area =63'

Posted by Sasikanth Sharma    2014-06-19 13:47:34

Congratulations Sasikanth Sharma. You are this dose winner. We will send you the link using which you can claim your recharge.

Posted by Merit Campus    2014-06-20 04:32:11