Interview Questions

How to retrieve the decimal part of value stored in float variable. Also how to retrieve the Integer part? Is there a function?

SilkTest Questions and Anwsers


(Continued from previous question...)

113. How to retrieve the decimal part of value stored in float variable. Also how to retrieve the Integer part? Is there a function?

the snippet code for the prob.
[ ] real rVal1=89.822 // Assume your real number is rVal1
[ ] integer iValue = [int]rVal1
[ ] real rVal2= rVal1-iValue
[ ] print(iValue) // Integer part of u r number
[ ] print(rVal2) // Decimal part of u r number

(Continued on next question...)

Other Interview Questions