• 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. import java.util.Scanner; public class StringComparator { public static void main(String args[]) { String str1, str2; Scanner scan = new Scanner(System.in); System.out.print("Enter First String […]

  • 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. import java.util.Scanner; public class DigitAdditionCalc { public static void main(String args[]) { int number, remdr=0, […]

  • 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. import java.util.Scanner; public class MarksCalculator { public static void main(String args[]) { int markArray[] = new int[5]; int i; float sum=0; float average, percentage; Scanner scan = new Scanner(System.in); […]

  • 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. import java.util.Scanner; public class Calculator { public static void main(String args[]) { float num1, num2, result; char operation, […]

  • 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. import java.util.Scanner; public class AlphabetFinder { public static void main(String args[]) { char character; Scanner scanner = new Scanner(System.in); System.out.print("Enter a Character : "); character = scanner.next().charAt(0); if((character>='a' && character<='z') || (character>='A' && character<='Z')){ System.out.print(character + " is an alphabet."); }else{ […]

  • 19 January

    Java program to check leap year

    In this post, we will see how to check leap year. import java.util.Scanner; public class LeapYearFinder { public static void main(String args[]) { int year; Scanner scanner = new Scanner(System.in); System.out.print("Enter Year : "); year = scanner.nextInt(); if((year%4 == 0) && (year%100!=0)){ System.out.print(year+" is a Leap Year"); }else if(year%100 == 0){ System.out.print(year+" is not a […]

  • 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. import java.util.Scanner; public class VowelFinder { public static void main(String args[]) { char character; Scanner sacnner = […]

  • 18 January

    Even odd program in java

    In this post,we will see how to check if number is even odd. It is one of the basic programs of Java programming language. import java.util.Scanner; public class EvenOddFinder { public static void main(String args[]) { int num; Scanner scanner = new Scanner(System.in); System.out.print("Enter a Number : "); num = scanner.nextInt(); if(num%2 == 0) { […]

Subscribe to our newletter

Get quality tutorials to your inbox. Subscribe now.