daily pastebin goal
48%
SHARE
TWEET

Untitled

a guest Jan 16th, 2019 67 Never
Not a member of Pastebin yet? Sign Up, it unlocks many cool features!
  1. #include <stdio.h>
  2. #include <stdlib.h>
  3.  
  4.  
  5. int main() {
  6.     int n;
  7.     scanf("%d", &n);
  8.     double m[n];
  9.     int prev = m[0];
  10.     int prev2 = m[0];
  11.     for (int i = 0; i < n; i++) {
  12.         scanf("%lf",&m[i]);
  13.     }
  14.     for (int i = 1; i < n - 2; i++) {
  15.         prev = m[i];
  16.         m[i] = (prev2 + m[i + 1]) / 2;
  17.         prev2 = prev;
  18.     }
  19.     for (int i = 0; i < n; i++) {
  20.         printf("%lf ",m[i]);
  21.     }
  22.     return 0;
  23. }
RAW Paste Data
We use cookies for various purposes including analytics. By continuing to use Pastebin, you agree to our use of cookies as described in the Cookies Policy. OK, I Understand
 
Top