Menu
Question Index
...

Write a program to get the probabilityfor choosing neither green nor red balls, give the number of red, blue and  green balls.

Input (Number Of Balls) Output
red = 5, blue = 6, green = 8 6 / ( 5 + 6 + 8 ) = 6 / 19 = .31579
red = 0, blue = 5, green = 10 5 / ( 0 + 5 + 10) = 5 / 15 = .33333
red = 5, blue = 8, green = 7 8 / ( 5 + 8 + 7 ) = 8 / 20 = .4



class Probability
{
    public static void main(String s[])
    {
        double chances = calculateProbability(5, 6, 8);
        System.out.println("The probability for getting neither green nor red balls is " + chances);

    }


        public static double calculateProbability(int red, int blue, int green)
        {
        }

}

Doubts

Problems

Topic: Basic Arithmetic Operators In Java

Read this topic
Take test on this topic

0
Wrong
Score more than 2 points

© meritcampus 2019

All Rights Reserved.

Open In App