Advertisement
golovanovd

lab_baranov

Feb 8th, 2016
80
0
Never
Not a member of Pastebin yet? Sign Up, it unlocks many cool features!
C 0.23 KB | None | 0 0
  1. #include <stdio.h>
  2. #include "math.h"
  3. int main(void) {
  4.     int N;
  5.     float S=0;
  6.     printf("Please, enter value N:");
  7.     scanf("%i", &N);
  8.     for(int i=0;i<=N;i++) {
  9.         S=S+pow(-1,i)/pow(2,i);
  10.         }
  11.     printf("\nS = %i", S);
  12.     return 0;
  13. }
Advertisement
Add Comment
Please, Sign In to add comment
Advertisement