mirror of
https://github.com/TheAlgorithms/Java.git
synced 2026-03-13 08:40:43 +08:00
Format code with prettier (#3375)
This commit is contained in:
@@ -18,11 +18,10 @@ public class DudeneyNumber {
|
||||
if (cube_root * cube_root * cube_root != n) {
|
||||
return false;
|
||||
}
|
||||
int sum_of_digits = 0;// Stores the sums of the digit of the entered number
|
||||
int temp = n;//A temporary variable to store the entered number
|
||||
int sum_of_digits = 0; // Stores the sums of the digit of the entered number
|
||||
int temp = n; //A temporary variable to store the entered number
|
||||
// Loop to calculate sum of the digits.
|
||||
while (temp > 0) {
|
||||
|
||||
// Extracting Last digit of the number
|
||||
int rem = temp % 10;
|
||||
|
||||
@@ -33,7 +32,7 @@ public class DudeneyNumber {
|
||||
temp /= 10;
|
||||
}
|
||||
|
||||
//If the cube root of the number is not equal to the sum of its digits we return false.
|
||||
//If the cube root of the number is not equal to the sum of its digits we return false.
|
||||
if (cube_root != sum_of_digits) {
|
||||
return false;
|
||||
}
|
||||
@@ -47,7 +46,9 @@ public class DudeneyNumber {
|
||||
* 125 Output - It is not a Dudeney Number.
|
||||
*/
|
||||
public static void main(String args[]) throws IOException {
|
||||
BufferedReader br = new BufferedReader(new InputStreamReader(System.in));
|
||||
BufferedReader br = new BufferedReader(
|
||||
new InputStreamReader(System.in)
|
||||
);
|
||||
System.out.println("Enter a Number: ");
|
||||
int n = Integer.parseInt(br.readLine());
|
||||
if (isDudeney(n)) {
|
||||
|
||||
Reference in New Issue
Block a user