java programs
- 20 January
Java program to print Diamond pattern
In this tutorial, we will see java program to print diamond pattern. [crayon-6743ec20592c3318926428/] That’s all about printing diamond pattern in java.
- 20 January
Java program to print Fibonacci Series
In this tutorial, we will print fibonacci series. According to wikipedia: In mathematics, the Fibonacci numbers are the numbers in the following integer sequence, called the Fibonacci sequence, and characterized by the fact that every number after the first two is the sum of the two preceding ones:[1][2] 0,1,1,2,3,5,8,13,21,34,55,89,144.. Here is simple program to print […]
- 19 January
How to Compare Two Strings in Java
In this post, we will see how to compare two String in java. As you might know, String implements Comparable interface, you can use compareTo method to compare two String in java. [crayon-6743ec205960f964420776/] Output: Enter First String : Java Enter Second String : Blog First String is Greater than Second String. That’s all about How […]
- 19 January
Java program for sum of digits of number
In this post, we will see how to find sum of digits of number in java. You can find unit’s place digit by number%10, add it to the total and divide the number by 10 to remove the unit’s place. [crayon-6743ec20596bb557232100/] Output: Enter a Number : 5385 Sum of digits of number 5385 is 21 […]
- 19 January
Java program to calculate average marks
In this post, we will see simple java program to find average and percentage marks. We have taken average and percentage of five subject marks below. [crayon-6743ec205974d701764243/] Output: Enter marks for 5 Subjects : 91 57 83 69 74 Average Marks = 74.8 Percentage = 74.8% That’s all about Java program to calculate average and […]
- 19 January
Java program to make simple calculator
In this post, we will see how to create a simple calculator in java. This calculator program performs 4 basic operatios – Addition, Substraction, Multiplication and division.It uses Switch case to choose operation you want to perform. [crayon-6743ec20597de371944761/] Output: 1. Addition 2. Subtraction 3. Multiplication 4. Division 5. ExitEnter your operation : 3 Enter Two […]
- 19 January
Java Program to Check Whether a Character is Alphabet or Not
This tutorial provides Java Program to Check Whether a Character is Alphabet or Not. [crayon-6743ec20598b3703080047/] Output: Enter a Character : d d is an alphabet. The ASCII value of lowercase alphabets range from 97 to 122. And, the ASCII value of uppercase alphabets range from 65 to 90. That’s why, we compared variable character between […]
- 19 January
Java program to check leap year
In this post, we will see how to check leap year. [crayon-6743ec205995e302048194/] Output: Enter Year : 2018 2018 is not a Leap Year That’s all about Java program to check leap year.
- 19 January
Java Program to check a Character is Vowel or Consonant
In this post, we will see how to check a Character is Vowel or Consonant. You just need to check if character is part of set {a,A,e,E,i,I,o,O,u,U}.If it is part of set then it is Vowel else Consonant. [crayon-6743ec2059a94356060031/] Output: Enter an Alphabet : g g is a Consonant That’s all about Java Program to […]