Java Program to Convert Octal Number to Decimal and vice-versa In this program, you’ll learn to convert octal number to a decimal number and vice-versa using functions in Java. Example 1: Program to Convert Decimal to Octal public class DecimalOctal{ public static void main(String[] args){ int decimal = 78; int octal = convertDecimalToOctal(decimal); System.out.printf(“%d …
Day: April 22, 2021
Java Program to Convert Octal Number to Decimal and vice-versa In this program, you’ll learn to convert octal number to a decimal number and vice-versa using functions in Java. Example 1: Program to Convert Decimal to Octal public class DecimalOctal{ public static void main(String[] args){ int decimal = 78; int octal = convertDecimalToOctal(decimal); System.out.printf(“%d …
Java Program to Convert Binary Number to Decimal and vice-versa In this program, you’ll learn to convert binary number to a decimal number and vice-versa using functions in Java. Example 1: Program to convert binary number to decimal public class BinaryDecimal{ public static void main(String[] args){ long num = 110110111; int decimal = convertBinaryToDecimal(num); …
Java Program to Find G.C.D Using Recursion In this program, you’ll learn to find the GCD (Greatest Common Divisor) or HCF using a recursive function in Java. This program takes two positive integers and calculates GCD using recursion. Example: GCD of Two Numbers using Recursion public class GCD{ public static void main(String[] args){ int n1 …
Java Program to Find Factorial of a Number Using Recursion In this program, you’ll learn to find and display the factorial of a number using a recursive function in Java. The factorial of a positive number n is given by: factorial of n (n!) = 1 * 2 * 3 * 4 * … …
(Binary Classification with Sonar Dataset: Baseline Keras Model in Python with Standardized data) In this Learn through Codes example, you will learn Binary Classification with Sonar Dataset: Baseline Keras Model in Python with Standardized data. Baseline_Keras_Model_in_Python_with_Standardized_data Python Example for Beginners Special 95% discount 2000+ Applied Machine Learning & Data Science Recipes Portfolio …
Java Program to Find the Sum of Natural Numbers using Recursion In this program, you’ll learn to find the sum of natural number using recursion in Java. This is done with the help of a recursive function. The positive numbers 1, 2, 3… are known as natural numbers. The program below takes a positive …
Java Program to Check Whether a Number can be Expressed as Sum of Two Prime Numbers In this program, you’ll learn to check whether a given number can be expressed as a sum of two prime numbers or not. This is done with the help of loops and break statements in Java. To accomplish …
Java Program to Make a Simple Calculator Using switch…case In this program, you’ll learn to make a simple calculator using switch..case in Java. This calculator would be able to add, subtract, multiply and divide two numbers. Example: Simple Calculator using switch Statement import java.util.Scanner; public class Calculator{ public static void main(String[] args){ Scanner reader …
Java Program to Display Factors of a Number In this program, you’ll learn to display all factors of a given number using for loop in Java. Example: Factors of a Positive Integer public class Factors{ public static void main(String[] args){ int number = 60; System.out.print(“Factors of ” + number + ” are: “); for(int i …