Skip to content
Open
Changes from 1 commit
Commits
File filter

Filter by extension

Filter by extension

Conversations
Failed to load comments.
Loading
Jump to
Jump to file
Failed to load files.
Loading
Diff view
Diff view
Prev Previous commit
solution of square number
  • Loading branch information
Nazmul-Hassan-10 committed Mar 17, 2024
commit 030a354e581f01caba140679a3c22264cf6dc79d
37 changes: 37 additions & 0 deletions square_number/en.md
Original file line number Diff line number Diff line change
@@ -0,0 +1,37 @@
# Dimik - Square Number

You have to write a program to find out whether a number is a perfect square or not.

### Solution
* Store the square root of the number in a variable
* check if the multiplication of that variable is equal to input the number

# C++
```cpp
#include <iostream>
#include <math.h>
using namespace std;

int main()
{
int test_case;
cin >> test_case;

for (int i = 1; i <= test_case; i++)
{
int num;
cin >> num;
int a = sqrt(num);
if (a * a == num)
{
cout << "YES" << endl;
}
else
{
cout << "NO" << endl;
}
}

return 0;
}
```