Home TechnologyProgrammingJava Subscribe to RSS

How To Create A Java Program That Will Create The Sum, Product And Average Of 3 Numbers;3,4 And 5?

Create a java program that will displays the sum, product and average of three numbers. Let the num 1=3, num2=4 and num3=5.

Answer Question

1 Answer - Sort by: Date | Rating

    Public static void main() {
        // declare variables
        int num1, num2, num3;
        int sum, product;
        double avg;
        
        // Variables initial values
        num1 = 3;
        num2 = 4;
        num3 = 5;
        
        // calculate sum, product, and average

        sum = (num1 + num2 + num3);
        product = (num1 * num2 * num3);
        avg = sum/3;

        // print

        System.out.print("Sum = " + sum);
        System.out.print("Product = " + product);
        System.out.print("Average = " + avg);
      }

    Hope this is what you want
    1 0

    Xarsh  

    answered 1 year ago

      More

         
         

        Ask a Question via Twitter

        Send a question to @askblurtit and we will publish it online and send you a reply everytime you receive an answer.

        Blurtit Store

        Get T-shirts, hoodies, caps and more at the Blurtit store

        Blurtit International