## Find the Area of a Circle – Java Program

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

@tutorialhorizon

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

What is Left Shift (<<) Operator: a<<b means left shift the bits of number a by b places. 3<<2 means left shift the bits of number 3 by 2 places. Result = 12 011...

Objective – Given three vertices coordinates or (X, Y) coordinates, write a program to find the area of a triangle. Example: Approach: Given the coordinates of the three vertices of any triangle are (X1,...

Algorithms – Java Program to find if Triangle can be formed using given 3 sides Objective– Given 3 side lengths, write a program to find out if using these 3 sides, a triangle can...

Objective: Given a number convert it to base 3 representation. Example: N = 35 Base 3 representation: 1022 N = 50 Base 3 representation: 1212 Approach: Till the number is greater than 0, keep...

Objective – Given three sides of triangle, write a program to find the area of a triangle. Heron’s Formula for finding area of triangle: First find the semi parameter of a triangle using formula,...

Objective: Given a number, write a program to find factorial of that number. What is Factorial Number? In mathematics, the factorial of a non-negative integer n, denoted by n!, is the product of all positive integers less than or equal to n. The value of...

Objective: Given a String, write a recursive program to reverse it. Example: Original String: tutorial horizon Reversed String: noziroh lairotut Approach: Take the first character out of the string, add it to the end...

Objective: Given a number, find the sum of all of the digits in the number. Example: Number = 3045 Sum = 3+0+4+5 = 12 Number = 231 Sum = 2+3+1 = 7 Approach: Initialize...

Objective– Given a string, write an algorithm to find the character in string which occurs maximum number of times. If more than one character has maximum and same count then print all of them...

We have already discussed about Graph basics. We recommend reading this before you continue to read this article. What is Weighted Graph? A Graph is called weighted graph when it has weighted edges which...

%d bloggers like this: