Blog

python tutorials and learn python

Created with Sketch.

Java Program to Find all Roots of a Quadratic Equation

Java Program to Find all Roots of a Quadratic Equation In this program, you’ll learn to find all roots of a quadratic equation and print them using format() in Java. The standard form of a quadratic equation is: ax2 + bx + c = 0, where a, b and c are real numbers and a…
Read more

Java Program to Find the Largest Among Three Numbers

Java Program to Find the Largest Among Three Numbers In this program, you’ll learn to find the largest among three numbers using if else and nested if..else statement in Java. Example 1: Find Largest Among three numbers using if..else statement public class Largest { public static void main(String[] args) { double n1 = -4.5, n2…
Read more

Java Program to Check Whether an Alphabet is Vowel or Consonant

Java Program to Check Whether an Alphabet is Vowel or Consonant In this program, you’ll learn to check whether an alphabet is a vowel or a consotant using if..else and switch statement in Java. Example 1: Check whether an alphabet is vowel or consonant using if..else statement public class VowelConsonant { public static void main(String[]…
Read more

Java Program to Check Whether a Number is Even or Odd

Java Program to Check Whether a Number is Even or Odd In this program, you’ll learn to check if a number entered by an user is even or odd. This will be done using if…else statement and ternary operator in Java. Example 1: Check whether a number is even or odd using if…else statement import…
Read more

Java Program to Swap Two Numbers

Java Program to Swap Two Numbers In this program, you’ll learn two techniques to swap two numbers in Java. The first one uses a temporary variable for swapping, while the second one doesn’t use any temporary variables. Example 1: Swap two numbers using a temporary variable public class SwapNumbers { public static void main(String[] args)…
Read more

Java Program to Compute Quotient and Remainder

Java Program to Compute Quotient and Remainder In this program, you’ll learn to compute quotient and remainder from the given dividend and divisor in Java. Example: Compute Quotient and Remainder public class QuotientRemainder { public static void main(String[] args) { int dividend = 25, divisor = 4; int quotient = dividend / divisor; int remainder…
Read more

Java Program to Find ASCII Value of a character

Java Program to Find ASCII Value of a character In this program, you’ll learn to find and display the ASCII value of a character in Java. This is done using type-casting and normal variable assignment operations. Example: Find ASCII value of a character public class AsciiValue { public static void main(String[] args) { char ch…
Read more

Java Program to Multiply two Floating-Point Numbers

Java Program to Multiply two Floating-Point Numbers In this program, you’ll learn to multiply two floating-point numbers in Java, store the result and display it on the screen. Example: Multiply Two Floating-Point Numbers public class MultiplyTwoNumbers { public static void main(String[] args) { float first = 1.5f; float second = 2.0f; float product = first…
Read more

Java Program to Add Two Integers

Java Program to Add Two Integers In this program, you’ll learn to store and add two integer numbers in Java. After addition, the final sum is displayed on the screen. Example: Program to Add Two Integers public class AddTwoIntegers { public static void main(String[] args) { int first = 10; int second = 20; int…
Read more

Java Program to Print an Integer (Entered by the User)

Java Program to Print an Integer (Entered by the User) In this program, you’ll learn to print a number entered by the user in Java. The integer is stored in a variable using System.in, and is displayed on the screen using System.out. Example: How to Print an Integer entered by an user import java.util.Scanner; public…
Read more