I have an assignment (so please don't give me code just an explanation/helpful hints). Basically I divide two integers that are input by the user (e.g. 8 & 13) and store the result in a double. So if I were to do 8/13 I would get 0.615384615384615384615384...

The user also enters another number n. This is the number they want after the decimal place. With the example above if the user entered 8 13 5 then they would get the digit 8 as it is the 5th digit after the decimal point.

I tried converting to a string using sprintf and searching through it from the position where the decimal point is and it works but it doesn't work for large numbers (i.e. 8 13 60000). So I am trying another way where I am trying to multiply out the decimal point from the double. However I am unsure how to go about doing this.

#include <stdio.h> #include <math.h> main() { int a; //First number to divide int b; //Second number to divide int n; //Number after decimal point to print int i; double divAnswer = 0; double fractional; double integer; scanf("%d %d %d", &a, &b, &n); divAnswer = (double)a/(double)b; fractional = modf(divAnswer, &integer); printf("%f", fractional); printf("\n%lf", pow(fractional, n)); }

As you can see I am trying to use pow but i'm not sure how to go about doing it. Any help would be appreciated.