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

Skip to content
# Tagged: Beginner

##
Check if Given Number is power of 2.

##
Rotate the given array in cycles

##
Print First n numbers in Fibonacci Series

##
Find the Area and Perimeter of Rectangle – Java Program

##
Reverse the given String using Stack

##
Stack Data Structure – Introduction and Implementation

##
Bubble Sort and Optimized Bubble Sort- Java Implementation

##
Find the Area of Triangle using base and height – Java Program

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

@tutorialhorizon

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

Objective: Given an array of integers, write a program to rotate the array in cyclic manner by one. Example: Int a [] = {1, 2, 3, 4, 5} Output: {2, 3, 4, 5, 1}...

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

A rectangle is a quadrilateral with four right angles. Say rectangle is given with side’s length A and B Area of Rectangle = A * B Perimeter of rectangle = 2(A+B) Code: Run This Code Output: Area of Rectangle:...

Objective: Given a String, write a java program to reverse the string using Stack Example: Input: “tutorial horizon” Output: “noziroh lairotut” Recommended: Please read Stack Data Structure before continue to read. Approach: Initialize a...

What is Stack?? Stack is an abstract data type (ADT) and very useful in programming. In computer science, a stack is an abstract data type that serves as a collection of elements. Majorly all the operations are done at only one...

In this article we will discuss about what is bubble sort, why it is considered as one of the simplest sorting algorithm, what its complexity, how we can improve the bubble sort algorithm. What...

Objective: Given the base and height of a triangle, using math formula for calculating the area of triangle, write an java program to calculate the triangle area. Area of a Triangle: (Base * Height)/2...

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

%d bloggers like this: