Advertisement
Not a member of Pastebin yet?
Sign Up,
it unlocks many cool features!
- #include <iostream>
- using namespace std;
- int main()
- {
- long int c,n=0;
- cin>>c;
- do
- ++n;
- while(((n*n+1)*n)/2!=c&&n<c);
- if((n*n+1)*n/2==c)
- cout<<n;
- else
- cout<<0;
- return 0;
- }
Advertisement
Add Comment
Please, Sign In to add comment
Advertisement