Open
Conversation
didva
requested changes
Nov 25, 2016
| public static boolean containDigitTwo(int a) { | ||
| boolean flag = false; | ||
| int aLast; | ||
| if(a == 0) |
There was a problem hiding this comment.
No need in this verification and assignment because your flag is already set to false.
| while((a/10) > 0){ | ||
| aLast = a%10; | ||
| a = a/10; | ||
| if((aLast == 2)|(a == 2)) { |
| int aLast; | ||
| if(a == 0) | ||
| flag = false; | ||
| while((a/10) > 0){ |
There was a problem hiding this comment.
It can be just a > 0. And there will be no need in additional (a == 2) verification.
| public class Task3 { | ||
| public static boolean isBetween(int a, int b, int c) { | ||
| return false; | ||
| if (((b >= a)&(b <= c))|((b >= c)&(b <= a))) |
There was a problem hiding this comment.
- Too many
(). - It's better to use
&&and||for current verifications. Please read about difference between||and|. - Can be just
return ((b >= a)&(b <= c))|((b >= c)&(b <= a));because result is boolean type.
| return 0; | ||
| double x1; | ||
| double x2; | ||
| if (a >=b){ |
There was a problem hiding this comment.
Please use Math.max() for these purpose.
| public class Task5 { | ||
| public static double calculateA(double x, double y, double z) { | ||
| return 0; | ||
| double b = 1 + (Math.pow(z,2)/(3 + (Math.pow(z,2)/5))); |
| public static double calculateS(double x) { | ||
| return 0d; | ||
|
|
||
| public int factorial(int n){ |
There was a problem hiding this comment.
Please change it to public static int factorial(int n)
| return result; | ||
| } | ||
|
|
||
| public double calculateS(double x) { |
| public static double calculateSum(double N) { | ||
| double res = 0; | ||
| int i; | ||
| for(i=0; i <(N+1); i++) |
| public static boolean isPowerOfThree(int n) { | ||
| return false; | ||
| boolean flag = true; | ||
| if(n == 0) |
This file contains hidden or bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Sign up for free
to join this conversation on GitHub.
Already have an account?
Sign in to comment
Add this suggestion to a batch that can be applied as a single commit.This suggestion is invalid because no changes were made to the code.Suggestions cannot be applied while the pull request is closed.Suggestions cannot be applied while viewing a subset of changes.Only one suggestion per line can be applied in a batch.Add this suggestion to a batch that can be applied as a single commit.Applying suggestions on deleted lines is not supported.You must change the existing code in this line in order to create a valid suggestion.Outdated suggestions cannot be applied.This suggestion has been applied or marked resolved.Suggestions cannot be applied from pending reviews.Suggestions cannot be applied on multi-line comments.Suggestions cannot be applied while the pull request is queued to merge.Suggestion cannot be applied right now. Please check back later.
No description provided.