Programming Articles - Page 557 of 3363

How To Check Whether a Number is a Goldbach Number or Not in Java?

Vivek Verma
Updated on 13-Jun-2025 12:26:57

5K+ Views

What is Goldbach Number? A number is said to be a Goldbach number if the number can be expressed as the addition of two odd prime number pairs. For example, let's consider the number 98 and find the pairs of prime numbers (19, 79). If you calculate the sum of 19 + 79, you get 98, so 98 is a Goldbach number. If we follow the above condition, then we can find that every even number larger than 4 is a Goldbach number because it must have any pair of odd prime number pairs. But the odd numbers are not satisfying because we know ... Read More

How To Check if a Given Point Lies Inside a Rectangle in Java?

Vivek Verma
Updated on 13-Jun-2025 12:08:27

3K+ Views

A Rectangle is a closed two-dimensional shape that has 4 sides and 4 corners. The opposite sides are of the same length and parallel to each other. All 4 interior angles are equal, angles measure 90 degrees. It is a four-sided polygon. Following is the diagram of the Rectangle: Checking Points Inside Rectangle A point is said to lie inside a rectangle if its x and y coordinates are between the x and y coordinates of the opposite corners of the rectangle. To determine whether the point lies within the rectangle, we will use the following approaches: ... Read More

How to Calculate Area of Enneagon in Java?

Mr. Satyabrata
Updated on 17-Nov-2022 10:58:33

219 Views

An enneagon refers to a polygon with 9 sides with 9 internal angles. Where all the sides of the polygon are equal it is called a regular enneagon which has an internal angle of 140 degrees, and the sum of all internal angles are 1260 degrees. An enneagon is also referred to as Nonagon. Area of enneagon can be calculated by using When Length of Side (s) is given Area = 6.1818 * (s * s) When circumradius (r) is given Area = 2.8925 * (r * r) When apothem (a) is given Area = 3.2757 * (a ... Read More

Golang Program to convert Hexadecimal to Decimal

Akhil Sharma
Updated on 16-Nov-2022 06:59:59

9K+ Views

In this article we are going to understand how to covert Hexadecimal to Decimal number using Golang Program. Hexadecimal Number Vs Decimal Numbers Any number contains 16 digits in it, it is based on base 16, which means hexadecimal numbers contains decimal number from 0 to 9 and extra 6 Alphabets. A−F. In go language all the hexadecimal numbers start with 0x or 0X. For example, 0x16F is a hexadecimal number Decimal numbers are the numbers which have base 10, which means each digit of a number can have an integer value ranging from 0 to depending on its position. ... Read More

Golang Program To Print X Star Pattern

Akhil Sharma
Updated on 16-Nov-2022 06:48:53

1K+ Views

In this tutorial, we will learn how to print X star pattern using Go programming language. Syntax for initialization; condition; update { statement(s) } Example: Go Program Code to Print x Star Pattern Using a Single Function Algorithm Step 1 − Import the package fmt and strconv package. Step 2 − Start function main (). Step 3 − Declare and initialize the variables. Step 4 − Use of for loop with condition and incrementor. Step 5 − Print the result using fmt.Println (). Example // GOLANG PROGRAM TO PRINT X STAR PATTERN package main ... Read More

Golang Program To Print Star Pascals Triangle

Akhil Sharma
Updated on 16-Nov-2022 06:36:55

705 Views

In this tutorial, we will learn how to print star Pascal’s triangle using Go programming language Example 1: Golang Code To Print Star Pascal Triangle Using Strconv Package Syntax func Itoa(x int) string Itoa() function takes in an integer parameter and returns the string representation of x when the base is 10 Algorithm Step 1 − Import the package fmt and strconv package. Step 2 − Start function main (). Step 3 − Declare and initialize the variables. Step 4 − Use of for loop with condition and incrementor. Step 5 − Print the result using fmt.Println (). ... Read More

Golang Program To Print Square Star Pattern

Akhil Sharma
Updated on 16-Nov-2022 06:32:51

684 Views

In this tutorial, we will learn how to print square star pattern using Go programming language. Syntax NESTED FOR LOOP: for [condition | ( init; condition; increment ) | Range] { for [condition | ( init; condition; increment ) | Range] { statement(s); } statement(s); } Example: Golang Program Code To Print Square Star Pattern Using A Single Function Algorithm Step 1 − Import the package fmt. Step 2 − Start the function main (). Step 3 − Declare and initialize the variables. ... Read More

Golang Program To Print Mirror Upper Star Triangle Pattern

Akhil Sharma
Updated on 16-Nov-2022 06:28:15

314 Views

In this tutorial, we will learn how to print downward triangle pattern using Go programming language. Syntax for initialization; condition; update { statement(s) } In the code, we use the for loop to repeat a block of code until the specified condition is met. Example: Golang Program to Print Download Triangle Star Pattern Using One Single Function Algorithm Step 1 − Import the package fmt. Step 2 − Start the function main (). Step 3 − Declare and initialize the variables. Step 4 − Use of for loop with condition and incrementor. Step 5 − ... Read More

Golang Program To Print Mirror Lower Star Triangle Pattern

Akhil Sharma
Updated on 16-Nov-2022 06:13:51

252 Views

In this tutorial, we will learn how to print the mirror lower star triangle pattern using G programming language. Syntax for initialization; condition; update { statement(s) } In the code, we use the for loop to repeat a block of code until the specified condition is met. Example: Golang Program to Print Mirror Lower Star Triangle pattern using One Single Function Algorithm Step 1 − Import the package fmt. Step 2 − Start the function main (). Step 3 − Declare and initialize the variables. Step 4 − Use of for loop with condition and ... Read More

Golang Program To Print Downward Triangle Star Pattern

Akhil Sharma
Updated on 16-Nov-2022 06:10:26

287 Views

In this tutorial, we will learn how to print downward triangle pattern using Go programming language. Syntax for initialization; condition; update { statement(s) } In the code, we use the for loop to repeat a block of code until the specified condition is met. Example: Golang Program To Print Download Triangle Star Pattern Using One Single Function Algorithm Step 1 − Import the package fmt. Step 2 − Start the function main (). Step 3 − Declare and initialize the variables. Step 4 − Use of for loop with condition and incrementor. Step 5 − ... Read More

Advertisements