• 22 January

    Matrix multiplication in java

    In this post, we will see how to multiply two matrices in java. import java.util.Scanner; public class MatrixOperator { public static void main(String args[]) { int r1, c1, r2, c2, sum = 0, i, j, k; Scanner in = new Scanner(System.in); System.out.print("Enter number of rows and columns of first matrix : "); r1 = in.nextInt(); […]

  • 22 January

    Java program to add two matrices

    In this post, we will see how to add two matrices in java.I am giving example for 33 matrix. You can extend it to nn matrices. import java.util.Scanner; public class MatrixOperator { public static void main(String args[]) { int i, j; int mat1[][] = new int[3][3]; int mat2[][] = new int[3][3]; int res[][] = new […]

  • 22 January

    Java program to subtract two matrices

    In this post, we will see how to subtract two matrices in java.I am giving example for 33 matrix. You can extend it to nn matrices. import java.util.Scanner; public class MatrixOperator { public static void main(String args[]) { int i, j; int mat1[][] = new int[3][3]; int mat2[][] = new int[3][3]; int res[][] = new […]

  • 22 January

    Convert celsius to fahrenheit in java

    In this tutorial, we will see simple java program to convert celsius to fahrenheit in java. You can convert celsius to fahrenheit using this formula. fh = (1.8*cen) + 32; import java.util.Scanner; public class TempConvertor { public static void main(String args[]) { float cen; double fh; Scanner scanner = new Scanner(System.in); System.out.print("Enter Temperature in Centigrade […]

  • 22 January

    Convert fahrenheit to celsius in java

    In this tutorial, we will see simple java program to convert fahrenheit to celsius in java. You can convert fahrenheit to celsius using this formula. cel = (fh-32) / 1.8; import java.util.Scanner; public class TempConvertor { public static void main(String args[]) { float fh; double cel; Scanner scanner = new Scanner(System.in); System.out.print("Enter Temperature in Fahrenheit […]

  • 20 January

    Java program to delete words from sentence

    In this post, we will see how to delete words from the sentence. You can just use String’s replaceAll method to replace the word with empty String(""). Here is simple java program to delete words from the sentence. import java.util.Scanner; public class StringOperator { public static void main(String args[]) { String str, word; Scanner scan […]

  • 20 January

    Java program to remove vowels from String

    In this tutorial we will see how to remove vowels from String in java. [toc] Using replaceAll() method We will use String’s replaceAll() method to remove vowels from String. import java.util.Scanner; public class StringOperator { public static void main(String args[]) { String str1, str2; Scanner scan = new Scanner(System.in); System.out.print("Enter a String : "); str1 […]

  • 20 January

    Java program to calculate arithmetic mean

    In this tutorial, we will see simple java program to calculate arithmetic mean. Here is simple algorithm to calculate arithmetic mean. Calculate sum of elements in the array Divide it by total number of element in the array. import java.util.Scanner; public class ArithMeanCalc { public static void main(String args[]) { int cnt, i, sum=0, mean; […]

  • 20 January

    Java program to count positive, zero and negative numbers

    In this post, we will see Java program to count positive, zero and negative numbers import java.util.Scanner; public class JavaProgram { public static void main(String args[]) { int contp=0, cntn=0, cntz=0, i; int arr[] = new int[10]; Scanner scan = new Scanner(System.in); System.out.print("Enter 10 Numbers : "); for(i=0; i<10; i++){ arr[i] = scan.nextInt(); } for(i=0; […]

Subscribe to our newletter

Get quality tutorials to your inbox. Subscribe now.