Aleksandr_Grigoryev

HW 3

Nov 22nd, 2017
76
0
Never
Not a member of Pastebin yet? Sign Up, it unlocks many cool features!
C++ 0.25 KB | None | 0 0
  1. #include <iostream>
  2. using namespace std;
  3. int main()
  4. {
  5.     const int n=5;
  6.     int a[n]={1,5,2,7,2},i;
  7.     double sum,s;
  8.     sum=0;
  9.     s=0;
  10.     for (i=0;i<n;i++)
  11.     sum=1/((double)a[i])+sum;
  12.     s=n/sum;
  13.     cout<<"s="<<s<<endl;
  14.     system("pause");
  15.     return 0;
  16. }
Advertisement
Add Comment
Please, Sign In to add comment