Not a member of Pastebin yet?
Sign Up,
it unlocks many cool features!
- bool fun(int n)
- {
- int x = (int)(sqrt(n));
- if (x*(x+1)==n)
- return true;
- else
- return false;
- }
- int main()
- {
- int a = 6 , b = 20;
- int res = 0;
- for (int i = a ; i <= b ; i++)
- if (fun(i))
- res++;
- return res;
- }
Add Comment
Please, Sign In to add comment