Run Code
|
API
|
Code Wall
|
Misc
|
Feedback
|
Login
|
Theme
|
Privacy
|
Patreon
Assignment 5 Cos(x)
//gcc 5.4.0 //CHANGE THE FACTORIAL, SO FAR IT IS INCREMENTING BY ONE STILL #include <stdio.h> #include <math.h> int main(void) { int i; int final; int n; int j=0; int sum1=0; int answer1=0; int denom1=1; scanf("%d", &n); int pow1=2.0; for (i=0; i<n; i++, pow1++) { denom1=j*denom1; j++; j++; printf("denominator is %d\n", denom1); printf("Value of n and pow1 = %lf\n", pow(n, pow1)); if ((pow1%4)==0.0) { sum1=(answer1/denom1)+sum1; } else{ sum1=sum1-(answer1/denom1); } answer1=pow(n, pow1); pow1++; } /* for (i=1; i<=n; i++) { if (j<=n) { denom1=j*denom1; j++; } else { continue; } } printf("factorial of %d is %d\n", n, denom1); */ final=1-sum1; printf("%d", final); return 0; }
run
|
edit
|
history
|
help
0
Access the structure variable
14th Feb Programming Project v.01
Deadlock
A_141121_factorial02
Assignment 4
123
upper case letter.c
lab 12 v1
Leap year check
la profe