In this tutorial, we will learn how to create pyramids with different patterns in Go programming languageSyntax NESTED FOR LOOP for [condition | ( init; condition; increment ) | Range] { for [condition | ( init; condition; increment ) | Range] { statement(s); } statement(s); } Example 1: Golang code to Create Pyramid And Pattern Using $ Algorithm Step 1 − Import the package fmt. Step 2 − Start function main (). Step 3 − Declare and initialize the variables. Step 4 − ... Read More
In this tutorial, we will learn how to check for palindrome in Go programming language. We will check for palindrome for both numbers and strings in separate examples. A palindrome is a word, number, phrase, or other sequence of symbols that reads the same backwards as forwards, such as the words civic or radar or numbers such as 22\2\22 or sentence such as “Mr. Owl ate my metal worm”. Example 1: Golang Program code to Show if a Number is palindrome using a Single Function Syntax Syntax of For loop Initialize for condition { } incrementor The initialization statement ... Read More
In the tutorial, we learn how to convert numeric data to hexadecimal number using Go programming language. The hexadecimal number system is described as a 16-digit number representation of numbers from 0 - 9 and digits from A - F. In other words, the first 9 numbers or digits are represented as numbers while the next 6 digits are represented as symbols from A - F. Example 1: Golang Program Code to Convert Data to Hexadecimal Number Using fmt.Sprintf() Function Syntax func Sprintf(format string, a ...interface{}) string The fmt.Sprintf() function in Go language formats according to a format specifier ... Read More
Electrical impedance is the measure of opposition produced by circuit elements in the path of alternating current. Therefore, the electrical impedance is the parameter related to the AC circuit. The electrical impedance is usually denoted by the symbol ‘Z’ and is measured in ohms $\mathrm{(\Omega)}$. The electrical impedance is a complex quantity, i.e. it has both magnitude and phase. The electrical impedance is basically the extended concept of resistance. It is the function of frequency of alternating current flowing in the circuit. It because the impedance comes into picture only when there is a frequency dependent element like inductor or ... Read More
In this tutorial, we will learn how to check if given two strings are anagrams of each other or not using Go programming language. A word or phrase formed by rearranging the letters of a different word or phrase by using all the letters exactly once is known as an anagram. Example − Roles anagram word is loser Binary anagram word is brainy The below example shows how to create an empty map using the built-in make () function. The make function allocates and initializes a hash map data structure and returns a map value that points to it. The specifics ... Read More
In this tutorial, we will learn how to check if a given string is numeric or not using Go programming language. We will be using the regexp package in Go to validate the numeric patterning of the string. Examples of numeric string − A string which has a numeric value in it T20CRICKET GOOD1 100PERCENT Syntax func MustCompile(str string) *Regexp //This function creates the regular expression func MatchString(pattern string, s string) (matched bool, err error) // This function returns a Boolean value that indicates whether a pattern is matched by the string Example 1: Golang Program Code ... Read More
In this tutorial, we will learn how to check for Armstrong number in Go programming language. An Armstrong number or the narcissist number is a number whose sum of digits raised to the power three equals the number itself. Example1: $\mathrm{(1^3) \:+ \:(5^3) \:+ \:(3^3)\:= \:153}$ Example2: $\mathrm{(3^3) \:+ \:(7^3) \:+ \:(1^3)\:= \:371}$ In the below examples, we will read an integer number and then check the given number is an Armstrong number using Golang program Syntax Syntax of For loop Initialize for condition { } incrementor The initialization statement is optional and executes before for ... Read More
In this tutorial, we will learn how to calculate the power using recursion technique in Go programming language. Power can be defined as a number being multiplied by itself a specific number of times. Exponent can be defined to the number of times a number is used in a multiplication. Powers and exponents are important tools to rewrite long multiplication problems in mathematics, especially in algebra. Example: 24 = 2 × 2 × 2 × 2 = 16, where 2 is the base and 4 is the exponent. A Recursion is where a function calls itself by direct or indirect ... Read More
In this tutorial we will write a Go-lang code to print a right Triangle star pattern. We will depict how you can print the star pattern in go language. * * * * * * * * * * How to print a star pattern? A right triangle star pattern is shown above, and in that pattern, you can see that stars are increasing with the increase in the number of rows. The pattern goes like this 1 star in first row, 2 stars in second row, and goes on. For loop for [condition | ( init; condition; increment) ... Read More
In this tutorial we will write a Go-lang code to print a Left Triangle star pattern. We will depict how you can print the star pattern in go language. * * * * * * * * * * How to print a star pattern? A left triangle star pattern is shown above, and in this pattern, you can see that stars are increasing with the increase in the number of rows. The pattern goes like this 1 star in first row, 2 stars in second row, and goes on. We will be ... Read More
Data Structure
Networking
RDBMS
Operating System
Java
iOS
HTML
CSS
Android
Python
C Programming
C++
C#
MongoDB
MySQL
Javascript
PHP