I'm not getting the expected result when I do division. Can someone please tell me what I'm doing wrong?

int page_list_size = 20; 
int page_fault_counter = 0;
double failure = 0.0;
double success = 0.0;
failure = page_list_size / page_fault_counter;
success = 1 - failure;
printf("failure Is %lf\n",failure);
printf("success Is %lf\n",success);

You cannot divide by zero as you do on line 5 when page-fault-counter is 0. Also, you are doing an integer divide and converting the resule to a double. You really should cast the numerator and denominator values (page_list_size and page_fault_counter) to doubles before the division. In any case, this should still result in a divide-by-zero error and cause the program to abort.