Jump to content

[C++]Ecuatie


FnZ
 Share

Recommended Posts

#include <iostream>

using namespace std;

int main()
{
    int n,i,S;
    float E;
    cout << "Numarul=";
    cin >>n;
    S=0;
    i=1;
    while (i<=n)
    {
        S=S+i;
        i=i+1;
    }
    E=(float) 1/S;
    cout << "Ecuatia="<<E;
    return 0;
}

E= 1/(1+2+..+n)

Link to comment
Share on other sites

Guest
This topic is now closed to further replies.
 Share

×
×
  • Create New...

Important Information

We have placed cookies on your device to help make this website better. You can adjust your cookie settings, otherwise we'll assume you're okay to continue.