6. Write a program to initialize fractional numbers 7.5, 3.2, 6.4. print the sum and product of the numbers.
Answers
Answered by
6
Hey there!
The program is as follows:
class Fractionalno
{
public static void main(String args[])
{
doube a,b,c=0;
a = 7.5;
b = 3.2;
c = 6.4;
double s = a + b + c;
double p = a*b*c;
System.out.println("Sum =" + s);
System.out.println("product =" + p);
}
}
Sample Output:
Sum = 17.1
Product = 153.6
Similar questions