Advertisement
STANAANDREY

medh

Nov 13th, 2018
266
0
Never
Not a member of Pastebin yet? Sign Up, it unlocks many cool features!
C++ 0.27 KB | None | 0 0
  1. #include <iostream>
  2. using namespace std;
  3.  
  4.  
  5. int main () {
  6.   float x,s=0.0;
  7.    int n,i=1;
  8.    cout<<"n= ";
  9.    cin>>n;
  10.    while (i<=n)
  11.    {
  12.        cout<<"nr"<<i<<'=';
  13.        cin>>x;
  14.        s=s+1/x;
  15.        i++;
  16.    }
  17.    cout<<"media armonica e: "<<n/s;
  18.   return 0;
  19. }
Advertisement
Add Comment
Please, Sign In to add comment
Advertisement