Not a member of Pastebin yet?
Sign Up,
it unlocks many cool features!
- #include <iostream>
- using namespace std;
- int f(int m,int n)
- {
- if (m==n) return m*n;
- else
- {
- int sr = (m + n) / 2;
- return (f(m, sr) + f(sr + 1, n));
- }
- }
- int main()
- {
- int m,n;
- cout << "Unesi m i n: ";
- cin >> m>>n;
- cout << "Suma kvadrata brojva od m do n = " << f(m,n);
- system("pause >nul");
- return 0;
- }
Advertisement
Add Comment
Please, Sign In to add comment