Java Coding
In java, to print the frequency of digits in given number we can use loop concepts such as while loop or for loop. For a given number, we have to find the occurrence of each digit. If the input number is 12234 then output should be digit 1 is only occurred one time, digit 2 […]
In Java, to find all prime factors of a number we can use loop concepts such as while loop or for loop. Prime number is number that is divisible by 1 and the number itself. For a given number, we should find all the prime factors (Exactly divides the number). If the input number is […]
In Java, to print all factors of a number we can use loop concepts such as while loop or for loop. For a given number, we should find all the factors (which are exactly divide that number) of that number as output. If the input is 6, then the output should be 1,2,3 and 6. […]
In Java, to swap two values using a third variable, we should know the concepts of operators and how to assign values. In this article we will learn swapping values using a third variable in java through an example, detailed logic and program explanation for better understanding. For example, if the two input numbers are […]
In Java, to swap values without using a third variable, we should understand operator concepts and how to assign values. In this article, we will learn how to swap two values without using a third variable through an example, detailed logic, and program explanation for better understanding. For example, if the input numbers are a=23 […]
In java, to swap first and last digit of number we can use loop concepts such as for loop and while loop. If the input number is 2345 then after swapping the first and last digit in that number, resulting output will be 5342. In this article we will learn an example, detailed logic and […]
In this tutorial we will learn writing Java Program to calculate the power for the given base and exponents using Math.pow() method. If user enters base as 3 and exponent as 4, output should be 81. We will also learn with example, detailed logic and program explanation for better understanding. Required Knowledge Problem Statement We […]
In java, to calculate power of a number without using pow method we can use loop concepts such as while loop or for loop. For the given base(number) and exponent (power) values, Power is calculated as multiplication of base to base for exponent times. If the input base is 2 and exponent is 5, output […]
In java, to check number is palindrome or not we can use loop concepts such as while loop or for loop. Palindrome number is defined as a number that is same even after reversing it. For example, 131 is a palindrome number. Writing from left to right or right to left will give same number […]
In java, to find all Strong numbers in a given range we can use loop concepts such as while loop or for loop. In this article, we will learn through examples, detailed logic and program explanation for better understanding. What is Strong Number? A “Strong number,” often referred to as a “factorial number” or a […]