## Calculate Log2n without using built-in function

Objective: Given a number n, write a program to calculate Log2n without using built-in function. Example: N = 32 Log232 = 5 N = 64 Log264 = 6 Approach: Initialize result = 0. Keep...

Skip to content# Tagged: Beginner

## Calculate Log2n without using built-in function

## Print First N Prime Numbers – Java Code

## Print My IP Address – Java Code

## Find the Circumference of a Circle – Java Program

## Check if two Strings are equal without using built-in function – Java

## Remove Vowels from a given String

## Linear Search Algorithm

## Floyd’s Triangle – Java Implementation

## Print Numbers from 1 to N without using loop

## Java Program to determine if Given Year is Leap Year

## Find the Area of a Circle – Java Program

## Fizz Buzz Challenge – Java Implementation

## Divide with power of 2 without using pow() or / operator

## Maximum Difference between two elements in array – Largest Gap Problem

## Minimum number of guesses needed to find a specific number

@tutorialhorizon

Objective: Given a number n, write a program to calculate Log2n without using built-in function. Example: N = 32 Log232 = 5 N = 64 Log264 = 6 Approach: Initialize result = 0. Keep...

Objective: Given a number N, write a program to print first N prime numbers. What is Prime number:?? A prime number (or a prime) is a natural number greater than 1 that cannot be...

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...

Area of a circumference = 2πR Where π = 3.14 and R = radius of circle Example: Radius = 4.0 Area = 2*π*radius = 2*3.14*4 = 25.12 Java Code:Run This Code Output: Area of...

Objective– Given two strings, find out if they are equal or not without using any built-in function (without using equals() function in java). Example: String x=’tutorial’ and String y=’tutorial’ are equal – true String...

Objective: Given a String, remove all the vowels from the string. What Are Vowels? The letters A, E, I, O, and U are called vowels. The other letters in the alphabet are called consonants....

Objective: Given an array [] of n elements and a element ‘x’, write a program to search an element ‘x’ in the array. Example: Input [] = {20, 30, 40, 10, 5, 2, 60,...

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...

Objective: Given a number N, write an program to print from number 1 to N without using loop. Example: N = 20 Output: 1 2 3 4 5 6 7 8 9 10 11 12...

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...

Area of a circle = πR2 Where π = 3.14 and R = radius of circle Example: Radius = 4.0 Area = π*radius*radius = 3.14*4*4 = 50.24 Code:Run This Code Output: Area of circle...

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...

Objective: Given a number n and k, Calculate n / k2 without using pow() or / operator. Example: N = 48, k = 4 N/k2 = 3 Approach: Bit Manipulation Right shift the number...

Objective: Given an array of numbers, write an algorithm to find the maximum difference between any two elements in the array. Example: Int [] a = {2, 8, 1, 6, 10, 4} Output: Maximum...

Objective– Given the numbers 1 to 1000, what is the minimum number of guesses needed to find a specific number if you are given the hint “higher” or “lower” for each guesses you make....

%d bloggers like this: