Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

solution of small to large number #500

Open
wants to merge 2 commits into
base: main
Choose a base branch
from
Open
Show file tree
Hide file tree
Changes from all commits
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
33 changes: 0 additions & 33 deletions .github/PULL_REQUEST_TEMPLATE.md

This file was deleted.

28 changes: 0 additions & 28 deletions .github/workflows/inactive_issue.yml

This file was deleted.

35 changes: 35 additions & 0 deletions small_to_large/en.md
Original file line number Diff line number Diff line change
@@ -0,0 +1,35 @@
# Dimik - Small to Large

There will be three different numbers. They have to be printed from small to large sizes.

### Solution
* Case number will be according to the number of test case.
* Finding the middle number which is not min or max is the main task.

### C++
```cpp
#include <iostream>
#include <algorithm>
using namespace std;

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

for (int i = 1; i <= test_case; i++){
int n1, n2, n3;
cin >> n1 >> n2 >> n3;
int a = min(min(n1, n2), n3);
int b = max(max(n1, n2), n3);
if (n1 != a && n1 != b)
{
cout << "Case " << i <<": " << a << " " << n1 << " " << b << endl;
} else if (n2 != a && n2 != b){
cout << "Case " << i <<": " << a << " " << n2 << " " << b << endl;
} else if (n3 != a && n3 != b){
cout << "Case " << i <<": " << a << " " << n3 << " " << b << endl;
}
}
return 0;
}
```
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;
}
```