Materi yang akan saya sajikan dibawah ini adalah tugas mata kuliah Statistika yakni tentang menghitung berapa besarnya sebuah peluang..
#include <conio.h>
#include <iostream.h>
#include <math.h>
#include <string.h>
void main ()
{
float a,b,s,P_A,P_B,AB,P_AB,P_AUB;
cout<<"Jumlah semua kejadian\t= ";
cin>>s;
cout<<"Kejadian A\t\t= ";
cin>>a;
cout<<"Kejadian B\t\t= ";
cin>>b;
cout<<"=============================="<<endl;
P_A = a/s;
cout<<"P_A\t= "<<P_A<<endl;
P_B = b/s;
cout<<"P_B\t= "<<P_B<<endl;
AB = a-b;
cout<<"AB\t= "<<AB<<endl;
P_AB = a+b/s;
cout<<"P_AB\t= "<<P_AB<<endl;
P_AUB = P_A+P_B-P_AB;
cout<<"P_AUB\t= "<<P_AUB<<endl;
getch();
}
Semoga bermanfaat ya kawan :)
This entry was posted on 00.19 and is filed under
C++ Peluang
. You can follow any responses to this entry through the RSS 2.0 feed. You can leave a response, or trackback from your own site.
0 komentar: