i just finished writing a function to solve the factoral of a user inputted int. In my main loop i need to display the function and let the user enter as many numbers as they want. After the user enters the numbers they want, they enter a key to quit the program and the factoral of all of the inputted numbers are displayed.
I cannot think right now and don't know what to do. Any tips are appreciated. My code i have so far is below:
Code:#include <stdio.h> #include <math.h> #define PI 3.141593 #define ot (float)1/3 void factoral (long n) { double power; double dividen; double sqrt_div; double num; double denom; long answer; printf("\n\nPlease enter the number you want to know the factoral of: "); scanf("%ld", &n); power = pow(n , n); dividen = (2 * n + ot) * PI; sqrt_div = sqrt(dividen); num = power * sqrt_div; denom = exp(n); answer = ceil(num / denom); printf("\nThe factoral of %ld is approximately: %ld\n\n", n, answer); return; } #include <stdio.h> void main(void) { double num; factoral(num); return; }



LinkBack URL
About LinkBacks



