Java Coding
In Java, to check a given number is strong or not we can use loop concepts such as while loop or for loop. For given integer input value, find the sum of the factorials of individual digits. If sum of individual factorials of digits is equal to the original number we say that is a […]
In Java, to find all Perfect numbers in a given range we can use loop concepts such as while loop or for loop. Perfect numbers are those numbers whose sum of factors excluding the number itself is equal to original number. For example, 6 is a Perfect number. In this article, we will learn through […]
In Java, to check if a given number is positive or negative or 0 we can use conditional statements such as if-else or switch statement. For example, if input number is -5, then the resulting output should be “-5 is a negative number”. In this article, we will learn through an example, detailed logic and […]
In Java, to check if a given character is vowel or consonant we can use conditional statements such as if else and switch statement. Here we are using switch statement. If input falls within the range of “a, e, i, o, u”, it should print vowel otherwise consonant. In this article, we are focusing on […]
In Java, to print all natural numbers in a given range we can use loop concepts such as while loop or for loop. For a given input range, we have to print every number in that range. For example, starting number is 1 and ending number is 5 as range, then output will be 1,2,3,4 […]
In Java, to print all Prime numbers in a given range we can use loop concepts such as while loop and for loop. Prime numbers are numbers which are divisible by 1 and the number itself. If the two input numbers 1 and 5, then the resulting output should be “2, 3 and 5”. In […]
In Java, to find sum of all prime numbers in a given range we can use loop concepts such as while loop or for loop. If the two input numbers are 1 and 5, then the output will be 10 (2+3+5=10). In this article, we are focusing on learning through examples, logic and program explanation […]
In Java, to print the sum of digits of a given number we can use loop concepts such as while loop or for loop. If the input number is 1234, then we need to add every digit of that number like 1+2+3+4 and print the output as 10. In this article we will learn writing […]
In java, to calculate LCM (Least Common Multiple) of two numbers we can use HCF or Brute Force Method or Multiples of Numbers. LCM also known as Lowest Common Multiple, Least Common Denominator (as it used while adding, subtracting of fractions, we find the lcm of denominators). When user enters two input values, we need […]
In java, to print HCF or Highest Common Factor (GCD) of two numbers we can use loop concepts such as while loop or for loop. For a given two values, we have to print largest/ highest common multiple of those two numbers. If the input numbers are 12 and 16, factors of 12 are 1,2,3,4,6 […]