Advertisement
Not a member of Pastebin yet?
Sign Up,
it unlocks many cool features!
- #include <stdio.h>
- int main (int argc, const char * argv[]) {
- int n;
- scanf("%d", &n);
- double result = 0.5;
- int brojac = 1;
- for(int i = 3; i <= n; i += 2) {
- if(brojac % 2 == 0) {
- result /= ( (double)i / (double)(i + 1) );
- }
- else {
- result *= ( (double)i / (double)(i + 1) );
- }
- brojac++;
- }
- printf("%lf\n", result);
- return 0;
- }
Advertisement
Add Comment
Please, Sign In to add comment
Advertisement