#include<stdio.h>
#include<math.h>
#include<conio.h>
#include<stdlib.h>
main()
{
int count, favorable,trials,c,n;
char s[100];
int a=0,d=0,i=0,f;
printf("enter the probablity");
fgets(s,sizeof(s),stdin);
a=strlen(s);
for(i=2;i<a-1;i++){
favorable=favorable*10+(s[i]-48);
}
trials=pow(10,a-3);
count=0;
printf("outcomes \n ------------------------------------- \n");
for ( c = 0 ; c <=trials ; c++ )
{
n=rand()%2;
if(n==1 && count<trials)
printf("YES \n");
else
printf("NO \n");
}
count++;
getch();
return 0;
}
#include<math.h>
#include<conio.h>
#include<stdlib.h>
main()
{
int count, favorable,trials,c,n;
char s[100];
int a=0,d=0,i=0,f;
printf("enter the probablity");
fgets(s,sizeof(s),stdin);
a=strlen(s);
for(i=2;i<a-1;i++){
favorable=favorable*10+(s[i]-48);
}
trials=pow(10,a-3);
count=0;
printf("outcomes \n ------------------------------------- \n");
for ( c = 0 ; c <=trials ; c++ )
{
n=rand()%2;
if(n==1 && count<trials)
printf("YES \n");
else
printf("NO \n");
}
count++;
getch();
return 0;
}
Post a Comment