Advertisement
Not a member of Pastebin yet?
Sign Up,
it unlocks many cool features!
- //perfect number Замечательные числа
- #include <iostream>
- #include <cmath>
- using namespace std;
- int main()
- {
- long a,b,i;
- double num;
- int k=0;
- cin>>a>>b;
- for(i=a;i<=b;i++){
- num=sqrt((2*i)-1);
- if(num-(int)num==0)
- k++;
- }
- cout<<k;
- return 0;
- }
Advertisement
Add Comment
Please, Sign In to add comment
Advertisement