#include <stdio.h>
#include <stdlib.h>
#include<time.h>
int main() {
int head_count=0, tail_count=0,x,total_toss=1000;
for(int i = 0; i<total_toss; i++) {
//printf(" %d ", rand()%2);
if(x%2==0){
head_count++;
}
else{
tail_count++;
}
}
printf("Probability of getting head %f \n",((float)head_count
/(float)total_toss
)); printf("Probability of getting tail %f",((float)tail_count
/(float)total_toss
));
return 0;
}
I2luY2x1ZGUgPHN0ZGlvLmg+IAojaW5jbHVkZSA8c3RkbGliLmg+IAojaW5jbHVkZTx0aW1lLmg+IAoKaW50IG1haW4oKSB7IAogICAgc3JhbmQodGltZSgwKSk7IAoJaW50IGhlYWRfY291bnQ9MCwgdGFpbF9jb3VudD0wLHgsdG90YWxfdG9zcz0xMDAwOwogICAgZm9yKGludCBpID0gMDsgaTx0b3RhbF90b3NzOyBpKyspIHsKICAgIAkvL3ByaW50ZigiICVkICIsIHJhbmQoKSUyKTsKICAgIAl4PXJhbmQoKSUyOwogICAgCWlmKHglMj09MCl7CgkJCWhlYWRfY291bnQrKzsKCQl9CgkJZWxzZXsKCQkJdGFpbF9jb3VudCsrOwoJCX0KICAgIH0KCQoJcHJpbnRmKCJQcm9iYWJpbGl0eSBvZiBnZXR0aW5nIGhlYWQgJWYgXG4iLCgoZmxvYXQpaGVhZF9jb3VudC8oZmxvYXQpdG90YWxfdG9zcykpOwoJcHJpbnRmKCJQcm9iYWJpbGl0eSBvZiBnZXR0aW5nIHRhaWwgJWYiLCgoZmxvYXQpdGFpbF9jb3VudC8oZmxvYXQpdG90YWxfdG9zcykpOwogIAogICAgcmV0dXJuIDA7IAp9IA==