Menu
Question Index
...

Write a program to multiply every array element with 6.0.

Input (Double Array) Output (Double Array)
{2.0, 3.1, 4.3, 7.5, 6.2, 1.0} {12.0, 18.6, 25.8, 45.0, 37.2, 6.0}
{3.0, 9.0, 1.0, -5.0, -16.0, 10.0} {18.0, 54.0, 6.0, -30.0, -96.0, 60.0}


    
class MultiplyEveryArrayElement
{
    public static void main(String s[])
    {
        double[] input = {2.0, 3.1, 4.3, 7.5, 6.2, 1.0};
        double[] output = multiplyEveryElement(input);
        System.out.print("Result after multiplying by 6.0 is : ");
        for(double outputElement : output)
        {
            System.out.print(outputElement + ", ");
        }

    }


    public static double[] multiplyEveryElement(double[] input)
    {
        double[] result = null;
        return result;
    }

}

Doubts

Problems

Topic: For-each Loop In Core Java Programming

Read this topic
Take test on this topic

0
Wrong
Score more than 2 points

© meritcampus 2019

All Rights Reserved.

Open In App