₦airaland Forum

Welcome, Guest: Register • Login • With Google • Trending • Recent • New

Stats: 3,344,197 members, 8,510,616 topics. Date: Friday, 30 October 2026 at 05:31 PM

Toggle theme

Please Help Me Write This Simple Php Switch Statement - Programming - Nairaland

Nairaland Forum › Science/Technology › Programming › Please Help Me Write This Simple Php Switch Statement (969 Views)

1 Reply (Go Down)

Please Help Me Write This Simple Php Switch Statement by Nobody: 12:45am On Jul 27, 2015
Nor laugh me oo grin

Question:

4 green balls
5 yellow balls
6 blue balls
7 white balls
9 black balls

if i pick 9 balls What is the the probability of picking black and white


The solution should be in a script
.Thanks
Re: Please Help Me Write This Simple Php Switch Statement by Abduletudaye(m): 5:10am On Jul 27, 2015
Yungwizzzy:
Nor laugh me oo grin

Question:

4 green balls
5 yellow balls
6 blue balls
7 white balls
9 black balls

if i pick 9 balls What is the the probability of picking black and white


The solution should be in a script
.Thanks
You've got to be kidding me undecided
Re: Please Help Me Write This Simple Php Switch Statement by DonSegmond(m): 5:12am On Jul 27, 2015
Yungwizzzy:
Nor laugh me oo grin

Question:

4 green balls
5 yellow balls
6 blue balls
7 white balls
9 black balls

if i pick 9 balls What is the the probability of picking black and white


The solution should be in a script
.Thanks
If you can't solve this, then perhaps your problem is not a programming problem, but a probability problem. You must be able to solve the problem on a piece of a paper before a computer. The computer is no substitute for thinking. With that said, if you want to know how to use a switch statement with php. http://php.net/manual/en/control-structures.switch.php For probability, this should help, http://mathforum.org/dr.math/faq/faq.prob.intro.html
Re: Please Help Me Write This Simple Php Switch Statement by veltany: 8:11am On Jul 27, 2015
<?php
/*
probability(p) is calculated as posible outcomes(x)/required outcomes(t).
P=x/t



func probability($arg1,$arg2)
return: int $result
*/


function probability($x,$t)
{ return $x/$t; }


//example
$p=probability(9,25);
echo $p;

?>
1 Reply

Magento Theme Tutorial: Find Out How To Switch To Different Theme • Fizzbuzz Problem Using "Switch" Statement Construct • Help A Java Newbie With This Simple Java Program • 2 • 3 • 4

Start A Programming Career With The Help Of Facebook • For All You Coders Out There • Online Product/service Payment In USD