Command-line arguments in Java

In Java, you can receive command-line arguments through the main function. Command-line arguments are those arguments which will be passed to a program through command-line. Program: Input: Output:

Fibonacci Series in Java

Fibonacci series is a series of numbers written in such a way that each number (leaving first two numbers 0, 1) is generated from the sum of previous two numbers. Ex: 0, 1, 1, 2, 3, 5, 8, 13, 21 Method 1: Simple but not optimal Method 2: Optimal References: Wiki Page – Fibonacci Number

Check Leap Year in Java

Everyone knows that in a leap year we will have 29 days in February month. But how can we determine a leap year programmatically? Rules to identify a leap year Year should be divisible by 4 but not by 100, or Year should be divisible by 400 Program

Computing Factorial in Java

Factorial of a positive integer n is multiplication of all positive integers from n till 1. Factorial is written as n!. 5! = 5 x 4 x 3 x 2 x 1 = 120 Factorial of zero is considered as 1 Finding Factorial using a loop Finding Factorial using Recursive Function

Palindrome Numbers

What is a Palindrome Number? Palindrome number is a number which remains same even after reversing its digits. Case Examples Palindrome Number 121, 2332, 34543, etc. Non-Palindrome Number 122, 2335, etc Palindrome Number in Java Let’s print palindrome number list using a for loop. Palindrome Number in C language