हिंदी

Evaluate the following Java expression, where a, b and c are integers and d and f are floating-point numbers. The values are a = 5, b = 3 and d = 1.5. f = a + b/a

Advertisements

प्रश्न

Evaluate the following Java expression, where a, b and c are integers and d and f are floating-point numbers. The values are a = 5, b = 3 and d = 1.5.

f  =  a + b/a

मूल्यांकन
Advertisements

उत्तर

a = 5, b = 3

Expression: f = a + b/a

In Java, both a and b are integers, so integer division is performed.

\[ f=a+\frac{b}{a} \]

\[ f=5+\frac{3}{5} \]

f = 5 + 0

f = 5.0

shaalaa.com
  क्या इस प्रश्न या उत्तर में कोई त्रुटि है?
अध्याय 6: Variables and Expressions - EXERCISE [पृष्ठ १३२]

APPEARS IN

धीरज मेहरोत्रा Computer Science [English] Class 12
अध्याय 6 Variables and Expressions
EXERCISE | Q 36. (a) | पृष्ठ १३२
Advertisements
Share
Notifications

Englishहिंदीमराठी


      Forgot password?
Use app×