Found 33676 Articles for Programming

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

Mr. Satyabrata
Updated on 17-Nov-2022 11:46:33

1K+ Views

A number is said to be an ugly number, if the prime factors of that input number only include 2, 3 and 5. Maybe some number has some prime factors which have only one factor or two factors but those factors must be one of 2, 3, and 5. In this article we will see how to check if a number is an Ugly number or not by using Java programming language. To show you some instances Instance-1 Input number is 20. Let’s check it by using the logic of Ugly number. Prime factors of 20 = 2, 2, 5 ... Read More

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

Mr. Satyabrata
Updated on 17-Nov-2022 11:43:09

20K+ Views

A number is said to be a Strong number, if the sum of factorials of the input number’s every digit is equal to the same input number. For more clarification, we have to find the factorial of every digit of the given number. After that we have to calculate the sum of those factorials. Then we have to compare both the sum value and input number, if they are same then the given number is a strong number otherwise it is not a strong number. In this article, we will see how to check if a number is a strong ... Read More

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

Mr. Satyabrata
Updated on 17-Nov-2022 11:35:11

2K+ Views

A number is said to be a Spy number, if the sum of the digits of the given number is equal to the product of the digits of the given number. For more clarification, we have to first calculate the sum of the digits of the given number. After that we have to calculate the product of the digits of the given number. Then we have to compare both the sum value and product value, if they are the same then the given number is a spy number otherwise it is not a spy number. In this article, we will ... Read More

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

Mr. Satyabrata
Updated on 17-Nov-2022 11:31:24

6K+ Views

A number is said to be a Special number, if the sum of factorials of the input number’s every digit is equal to the same input number. For more clarification, we have to find all the factors of every digit of the given number. After that we have to calculate the sum of those factorials. Then we have to compare both the sum value and input number, if they are the same then the given number is a special number otherwise it is not a special number. In this article, we will see how to check if a number is ... Read More

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

184 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

8K+ 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

669 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

Advertisements