Write a recursive algorithm which takes floating number as input and displays real and
integer part seperately.
Answers
Answered by
0
The algorithm that takes floating number as input and displays real and
integer part separately is as follows:
class Maths
{
public static void main(String args[])
{
double x = 7.3;
int y = (int)Math.floor(a);
double z = x - b;
System.out.println("Integral part = " + y);
System.out.println("Fractional part = " + z);
}
}
Similar questions
Art,
4 months ago
Sociology,
4 months ago
Math,
4 months ago
Computer Science,
9 months ago
Chemistry,
9 months ago
French,
11 months ago
Computer Science,
11 months ago
Hindi,
11 months ago