Category: MISC

0

Print Number with its Sign in Java

Sometimes we need to print the numbers with its sign irrespective of number is positive (+) or negative(-). Example: X = 5, print = +5 Y = -8, print = -8 Say we need...

0

Check if Given Number is power of 2.

Objective: Given a number, write a program to find if number is power of two. Example: N = 5 Output: false. N = 8 Output: true (23) N = 512 Output: true (29) Approach:...

0

Print First n numbers in Fibonacci Series

Objective: Write a program to print first n numbers in Fibonacci series. Fibonacci number: First two Fibonacci numbers are defined as 0 and 1 and every number after the first two is the sum...

0

Print My IP Address – Java Code

Objective: Write a java program to print your IP address. Approach: Get the local host address of your system using getLocalHost() method. Use getHostAddress() method to get the IP address from local host address. Code:Run This Code...

0

Floyd’s Triangle – Java Implementation

Floyd’s Triangle: Floyd’s triangle is a right angled triangular array of natural numbers. It named after Robert Floyd. Rows of the triangle filled by consecutive numbers. First row will have single number which is...

0

Java Program to determine if Given Year is Leap Year

Objective: Given a Year, write a java program to find whether year is leap year or not. Leap Year: a year, usually occurring once every four years, that has 366 days including February 29...

0

Fizz Buzz Challenge – Java Implementation

Objective: Write a program that prints the numbers from 1 to 100. But for multiples of three print “Fizz” instead of the number and for the multiples of five print “Buzz”. For numbers which...

%d bloggers like this: