Found 26504 Articles for Server Side Programming

Golang Program to Count Trailing Zeros in Factorial of a Number

Siva Sai
Updated on 19-Apr-2023 09:47:46

242 Views

In mathematics, factorial is a function that multiplies a given number by every positive integer less than or equal to that number. The result of this function is denoted by the symbol !. For example, the factorial of 5 is 5! = 5 x 4 x 3 x 2 x 1 = 120. In this article, we will discuss how to write a Golang program to count the number of trailing zeros in the factorial of a number. Algorithm to Count Trailing Zeros in Factorial of a Number The algorithm to count the number of trailing zeros in the factorial ... Read More

Golang Program to Check Status of a URL_Website

Siva Sai
Updated on 19-Apr-2023 13:18:58

1K+ Views

When building web applications, it's essential to ensure that all URLs and websites are functional and accessible to users. Checking the status of a URL or website is crucial in determining whether there is an issue that needs to be addressed. In this article, we will discuss how to write a Golang program to check the status of a URL/website. What is URL/Website Status? The status of a URL or website is a representation of its accessibility and functionality. URLs or websites can have different status codes depending on the outcome of the request. For example, a status code of ... Read More

Golang Program to Check if the String is Alphanumeric

Siva Sai
Updated on 19-Apr-2023 09:44:35

3K+ Views

In Go programming language, it is essential to check if a string contains alphanumeric characters or not. Alphanumeric characters are a combination of alphabets and numbers, and they are commonly used in passwords, usernames, and other important data. In this article, we will discuss how to write a Golang program to check if a string is alphanumeric. What is an Alphanumeric String? An alphanumeric string is a string that contains a combination of alphabets and numbers. It can also include special characters such as underscore (_) and dash (-), but not all special characters are considered alphanumeric. Alphanumeric strings are ... Read More

Pythagorean Quadruple

Vanshika Sood
Updated on 19-Apr-2023 11:13:12

710 Views

A group of four positive integers (a, b, c, and d) that satisfy the Pythagorean equation are called Pythagorean quadruples. The equation can be written as: a2 + b2 + c2 = d2 , with ‘d’ being the largest value out of the given numbers. In other words, the square of the fourth integer should be equal to the sum obtained by adding the squares of the previous three numbers. (1, 2, 2, 3) is a Pythagorean quadruplet as (12 + 22 + 22) = (1 + 4 + 4) = (9) = (32). Due to the requirement ... Read More

Palindromic Selfie Numbers

Vanshika Sood
Updated on 19-Apr-2023 11:08:35

325 Views

A number is considered to be a “Selfie Number” if it can be represented using only its own digits and certain mathematical operations. For example, 936 is a selfie number. $$\mathrm{936\:=\:(\sqrt{9})!^{3} \:+\:6!\:=\:216\:+\:720\:=\:936}$$ Here it can be observed that a series of operations are performed on the digits of the original number and the resultant is equal to the original number. Palindromic Selfie Numbers are a special kind of selfie number. They satisfy the selfie multiplicative rule. Consider a number x. Let the number formed by reversing the digits of x be $\mathrm{x^\prime}$. Let y be a ... Read More

Closest Numbers from a List of Unsorted Integers

Vanshika Sood
Updated on 19-Apr-2023 11:06:15

1K+ Views

In the following article, we discuss two approaches to find the closest numbers from a list of unsorted integers. Let us first understand what is meant by the term ‘closest numbers’. Closest numbers are the pair(s) of numbers which have the least difference between them. Problem Statement Given a list of distinct unsorted integers, we need to find the pair of elements that have the least difference between them. If there are multiple pairs, we need to find all of them. Furthermore, in the article wherever there is a mention of difference, it means absolute difference. Examples Input: [44, 42, ... Read More

Delete a Linked List Using Recursion

Vanshika Sood
Updated on 19-Apr-2023 11:04:06

1K+ Views

Linked List A linked list is a linear data structure in which the elements are stored at non-contiguous memory locations. Each element consists of a node. A node is composed of a data field, which holds the value of the element, and an address field, which points to the location of the next node in the series. The first node of the linked list is referred to as the ‘head’ of the list. The last element of the linked list can be defined as the element which points to NULL. A diagrammatic representation of a linked list is shown below. ... Read More

To Check if a Number is a Munchhausen Number

Vanshika Sood
Updated on 19-Apr-2023 11:02:04

809 Views

Munchhausen Numbers are peculiar numbers which possess a unique property. A number is considered to be munchhausen if the sum of the digits of the number, raised to their own power, is equal to the original number. These numbers are uncommon and not many of them are known. If the definition 00 = 0 is used, then 0 can also be considered a munchhausen number. The following article provides a method to determine whether a number is munchhausen or not while keeping in mind these characteristics of munchhausen numbers. Problem Statement The task at hand is to check whether a ... Read More

Position of n among the numbers made of 2, 3, 5 & 7

Rinish Patidar
Updated on 18-Apr-2023 15:36:38

304 Views

The problem statement includes printing the position of n among the numbers made of 2, 3, 5 and 7, where n will be any positive number given by the user. The numbers made of 2, 3, 5 and 7 means this will be the sequence of the strictly increasing numbers which comprises only digits 2, 3, 5 or 7 i.e. first four prime numbers. The first few numbers of the sequence where all numbers have only 2, 3, 5 and 7 as their digits are 2, 3, 5, 7, 22, 23, 25, 27, 32, 33, 35, 37, and so on. ... Read More

Java Math incrementExact(int x) method

Rinish Patidar
Updated on 18-Apr-2023 15:31:52

197 Views

We will explore Java Math incrementExact(int x) method by using the function in Java and understanding its different functionalities. An incrementExact() function is an in-built function in Java in the Math library. This function is used to return a value equal to the parameter passed in the function increased by 1. The function returns an exception due to integer overflow if the value of the integer passed in the function as an argument overflows depends on the data type passed in the function i.e. either int or long.Syntax Syntax of the function − int a; int incrementExact(a); long a; ... Read More

Advertisements