-
Notifications
You must be signed in to change notification settings - Fork 19
Pract.03| Aleksandra Kirilova #20
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
base: main
Are you sure you want to change the base?
Conversation
| cout << endl; | ||
| } | ||
| } | ||
| else { |
There was a problem hiding this comment.
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; |
There was a problem hiding this comment.
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; |
There was a problem hiding this comment.
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) { |
There was a problem hiding this comment.
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; |
There was a problem hiding this comment.
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++) { |
There was a problem hiding this comment.
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
|
Overall good job, you have made quite a progress |
No description provided.