Basic

Java Program to Calculate Compound Interest

Here you will get java program to calculate compound interest. We can calculate compound interest by following formula. Compound Interest = Principle * (1 + Rate / 100) time Also Read: Java Program to Calculate Simple Interest import java.util.Scanner; public class JavaCompoundInterest { public static void main(String args[]){ double p, r, t, ci; Scanner sc = new …

Java Program to Calculate Compound Interest Read More »

Java Program for Addition of Two Numbers

Here you will get java program for addition of two numbers. It is the very basic java program that is useful for beginners. import java.util.Scanner; public class AddTwoNumbers { public static void main(String args[]){ int a, b, sum; Scanner sc = new Scanner(System.in); System.out.print(“Enter first number: “); a = sc.nextInt(); System.out.print(“Enter second number: “); b …

Java Program for Addition of Two Numbers Read More »

Java Program to Swap Two Numbers Without Using Third Variable

Here you will get java program to swap two numbers without using third variable or temporary variable. We can do this in 3 ways as mentioned below. Also Read: Java Program to Swap Two Numbers Using Temporary Variable   1. Using Addition & Subtraction Operator We can swap two numbers using addition (+) and subtraction (-) …

Java Program to Swap Two Numbers Without Using Third Variable Read More »