From e31837930a4d1bfb018261cf5f6c827baf05b59c Mon Sep 17 00:00:00 2001 From: Arpita Das <63078004+Arpiiitaaa@users.noreply.github.com> Date: Sat, 1 Oct 2022 18:16:20 +0530 Subject: [PATCH] Create Square_Root_of_an_Integer --- CPP/sorting/Square_Root_of_an_Integer | 9 +++++++++ 1 file changed, 9 insertions(+) create mode 100644 CPP/sorting/Square_Root_of_an_Integer diff --git a/CPP/sorting/Square_Root_of_an_Integer b/CPP/sorting/Square_Root_of_an_Integer new file mode 100644 index 00000000..6449e261 --- /dev/null +++ b/CPP/sorting/Square_Root_of_an_Integer @@ -0,0 +1,9 @@ + public: + int countSquares(int N) + { + double sqT = sqrt(N); + if(ceil(sqT) == floor(sqT)) + return (int)sqT-1; + return (int)sqT; + } +};