Welcome, Guest: Register On Nairaland / LOGIN! / Trending / Recent / New
Stats: 3,151,892 members, 7,814,015 topics. Date: Wednesday, 01 May 2024 at 01:14 AM

Someone Help Me Out Plssss With Some C Programming - Programming - Nairaland

Nairaland Forum / Science/Technology / Programming / Someone Help Me Out Plssss With Some C Programming (1144 Views)

C Programming Challenge To Be Solved Under 10 Minutes / Php,mysql And Java Materials Needed Plssss (2) (3) (4)

(1) (Reply) (Go Down)

Someone Help Me Out Plssss With Some C Programming by eesaah(m): 8:43am On Sep 18, 2007
Pls someone should help me with a C or C++ program for binomial probability computation.
the formular is:
probability={n!/((n-x)!*x!)}*(P^x)*((1-P)^(n-x))

Where; n!= n factorial, x!=x factorial
n,x,p are all variables

Thanks
Re: Someone Help Me Out Plssss With Some C Programming by Kobojunkie: 1:14pm On Sep 18, 2007
The Thing about most of these is that is you search online for a while you will find a lot of tutorials and articles to help you do your assignment. The Key is to search and google.com provides you with a great search tool . Here is a link for you, if you need more, please google


http://www.codeproject.com/cpp/calc_prob.asp



Kobojunkie
Re: Someone Help Me Out Plssss With Some C Programming by eesaah(m): 2:09pm On Sep 18, 2007
@Kobojunkie, thanks a million.
Re: Someone Help Me Out Plssss With Some C Programming by AhmedGuru(m): 3:16pm On Sep 26, 2007
I dont av C/C++ IDE here to compile a C/C++ program.
But if u dont mind, this is a simple C# version for it.
A C# console program, written and tested working fine!

using System;

class binomial_probability
{
static void Main(string[] args)
{
int x = 2, n = 5;
float p = 0.1265f;
double prob = Probability(x, n, p);
Console.WriteLine("Binomial Probalibity for x={0}, n={1}, P={2} is {3}", x, n, p, prob);
}

public static long Factorial(int n)
{
long fact = 1;
if (n > 0)
{
for (long i = 1; i <= n; i++)
fact *= i;
}
else fact = 0;
return fact;
}

public static double Probability(int x, int n, float p)
{
//probability={n!/((n-x)!*x!)}*(P^x)*((1-P)^(n-x))
double prob = (Factorial(n) / Factorial(n - x) * Factorial(x)) * Math.Pow(p, x) * Math.Pow((1 - p), (n - x));
return prob;
}
}

Have a great day

(1) (Reply)

Where Can I Learn Android Programming In Asaba? / HACKERPOST NIGERIA - Nigeria's First Internet Security News Channel / Business Intelligence & Data Warehouse Professional Needed

(Go Up)

Sections: politics (1) business autos (1) jobs (1) career education (1) romance computers phones travel sports fashion health
religion celebs tv-movies music-radio literature webmasters programming techmarket

Links: (1) (2) (3) (4) (5) (6) (7) (8) (9) (10)

Nairaland - Copyright © 2005 - 2024 Oluwaseun Osewa. All rights reserved. See How To Advertise. 10
Disclaimer: Every Nairaland member is solely responsible for anything that he/she posts or uploads on Nairaland.