Dremendo Tag Line

Print sum of 3 float numbers in Java

Java Output - Question 7

In this question, we will see how to print the sum of 3 float numbers in java programming using the java output. To know more about java output click on the java output lesson.

Q7) Write a program in java to print the sum of 3 float numbers like float a=4.5, b=9.0, c=8.63.

Program

public class Q7
{
    public static void main(String args[])
    {
        float a=4.5f, b=9.0f, c=8.63f;
        System.out.println("Sum=" + (a+b+c));
    }
}

Output

Sum=22.13
video-poster