Not a member of Pastebin yet?
Sign Up,
it unlocks many cool features!
- #include<iostream>
- using namespace std;
- int main()
- {
- int n, m;
- double suma = 0;
- do
- {
- cout << "Unesite m: ";
- cin >> m;
- } while (m < 0);
- do
- {
- cout << "unesite n: ";
- cin >> n;
- } while (n < 0);
- for (int i = 1; i <= m; i++)
- {
- if (i % 2 == 0)//paran
- suma -= 1 / (double)(n + i*m);
- else
- suma += 1 / (double)(n + i*m);
- }
- cout << "suma je: " << suma << endl;
- system("PAUSE");
- return 0;
- }
Advertisement
Add Comment
Please, Sign In to add comment