• 31 March

### FizzBuzz program in java

In this post, we will see how to program FizzBuzz in java. Fizzbuzz is a fun game played generally by school children. It is simple game in which when your turn comes, you need to say the next number. So here are rules of the game: If number is divisible by 3, then you need […]

• 30 March

### Implement isPrime method in java

In this post, we will implement isPrime method. isPrime method will take an integer as input and determine whether the number is prime or number. A prime number is a number which has only two divisors 1 and itself. To check if the number is prime or not, we need to see if it has any […]

• 10 March

### Print pyramid pattern: 1 3*2 4*5*6 pattern in java

In this post, we will see how to print the following pyramid pattern. Problem Input : n = 4 Output : 1 3*2 4*5*6 10*9*8*7Input : n = 5 Output : 1 3*2 4*5*6 10*9*8*7 11*12*13*14*15 Solution If you notice the pattern we need to print odd rows in increasing order and even rows in […]

• 22 January

### Matrix multiplication in java

In this post, we will see how to multiply two matrices in java. [crayon-61a2b7f54ffd8889783865/] Output: Enter number of rows and columns of first matrix : 2 2 Enter first matrix elements : 2 4 6 8 Enter number of rows and columns of second matrix :2 2 Enter second matrix elements : 3 6 9 […]

• 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. [crayon-61a2b7f5508a2631742751/] Output: Enter matrix 1 elements : 11 22 33 44 55 66 77 88 99 Enter matrix 2 elements : 10 20 30 40 50 60 70 80 […]

• 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. [crayon-61a2b7f551100645130832/] Output: Enter Matrix 1 Elements : 11 22 33 44 55 66 77 88 99 Enter Matrix 2 Elements : 10 20 30 40 50 60 70 80 […]

• 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; [crayon-61a2b7f5519b2854195376/] Output: Enter Temperature in Centigrade : 30 Equivalent Temperature in Fahrenheit = 86.0

• 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; [crayon-61a2b7f5522f9943438886/] Output: Enter Temperature in Fahrenheit : 79 Equivalent Temperature in Celsius : 26.11111111111111

• 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. [crayon-61a2b7f552bc1047990668/] Output: Enter a String : Java2Blog is a technical blog. Enter a Word you want to […]