Skip to content

Conversation

@alikirilova
Copy link

No description provided.

cout << endl;
}
}
else {
Copy link
Collaborator

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

make it if(!arePositive) cout <<"invalid output"
its not wrong but looks better


if (num > 0) {

int max = 0;
Copy link
Collaborator

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

could use inline ternary operator

if (num > 0) {

int max = 0;
int min = 0;
Copy link
Collaborator

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

same here and after that remove the if-else

int commonDivisorsCount = 0;
for (int i = 1; i <= min; i++) {
if (min % i == 0) {
if (max % i == 0) {
Copy link
Collaborator

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

use one if and && operator


for (int c = 1; c <= N; c++) {

pythagoreanTh = (a * a + b * b) == c * c;
Copy link
Collaborator

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

if this is true the next row is right so you can skip the check


for (int b = a; b <= N; b++) {

for (int c = 1; c <= N; c++) {
Copy link
Collaborator

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

should start form c=b

@Radopeev
Copy link
Collaborator

Radopeev commented Nov 3, 2024

Overall good job, you have made quite a progress

Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment

Labels

None yet

Projects

None yet

Development

Successfully merging this pull request may close these issues.

2 participants