Not a member of Pastebin yet?
Sign Up,
it unlocks many cool features!
- #include <iostream>
- using namespace std;
- int main()
- {
- int p, k, i, j, sum=0, finalSum=0, l;
- bool test;
- cin >> p >> k;
- for( ; p<=k; p++)
- for(i=0; i<=p; i++)
- {
- for(j=i; j<=p; j++)
- if((i*i)+(j*j) == p) { finalSum++; test=true; break; }
- if(test) { test=false; break; }
- }
- cout << finalSum;
- return 0;
- }
Advertisement
Add Comment
Please, Sign In to add comment