In this tutorial, we will write a go language program to insert multiple elements into an array at the specified index. There are many methods to add elements into an array. it can be done by either using indexing or by using for loops. There are some inbuilt functions too using which we can add elements at specified index. Syntax func make ([] type, size, capacity) The make function in go language is used to create an array/map it accepts the type of variable to be created, its size and capacity as arguments. func append(slice, element_1, element_2…, element_N) []T ... Read More
In this tutorial, we will write a go language program to insert an element into an array at the specified index. There are many methods to add elements to an array. it can be done by either using indexing or by using for loops. There are some inbuilt functions too using which we can add elements at the specified indexes. Syntax func make ([] type, size, capacity) The make function in go language is used to create an array/map it accepts the type of variable to be created, its size and capacity as arguments func append(slice, element_1, element_2…, element_N) ... Read More
In this tutorial, we will see to write a go language program to find uncommon elements in two arrays. In this article we will write two programs. In the first program we will use the array of strings while in the second one we will use the array of integers. Algorithm STEP 1 − import the fmt package. STEP 2 − Define three functions named intersection(), uniquearr1 and uniquearr2. STEP 3 − The intersection() finds the common array elements from the two arrays while the other two functions remove that common elements from given arrays. STEP 4 − All these ... Read More
In this tutorial, we will write a go language program to reverse the elements of the array using inbuilt functions. in this program we will see how we can reverse an array of strings and integers using internal go functions. Method 1: Using Append() and Make() Function Syntax func make ([] type, size, capacity) The make function in go language is used to create an array/map it accepts the type of variable to be created, its size and capacity as arguments func append(slice, element_1, element_2…, element_N) []T The append function is used to add values to an array ... Read More
In this article you will learn the go language code to convert binary number to octal number. Binary numbers are the numbers that have base 2, i.e., each digit can have only 2 possibilities 0 and 1. Octal numbers are the numbers that have base 8, i.e., each digit can have only 8 possibilities from 0 to 7. Algorithm STEP 1 − Import the fmt package. STEP 2 − Start the main function and initialize the required variables of type int naming binary, octal, remainder and j. store initial values to them. STEP 3 − Store the binary number chosen ... Read More
In this tutorial, we will see to write a go language program to find common elements in two arrays. In this article we will write two programs. in the first program we will use the array of strings while in the second one we will use the array of integers. Method 1: Using Append() Function The following code illustrates how we can find the common elements in two different arrays of strings using an external function in go programming language. The function which we will create takes the two arrays as an argument to it and returns the final array ... Read More
In this tutorial, we will write a go language program to get the first given number of items from an array. We can do this by either using the inbuilt functions in go or by using for loops. The first method is more efficient in functionality than the second one but we will discuss both these methods in this program. Method 1: Getting items from an array of integers using internal functions In this method, we will write a go language program to get the first given number of items from an array by using the append() library function. Syntax ... Read More
For us, the world is available with a click. We are spoiled with information, so it becomes difficult for companies to draw our attention. Through age-old methods of advertising, companies have been dragging the attention of consumers to their products, services, and brand names. Through the creative storytelling process, they have been able to tell us the benefits of the product, why it is preferable to the competitor’s product, and why and how the consumer should buy the product. However, after years of being exploited by companies (selling us things we don't need) through lucrative advertisements, consumers have become banner ... Read More
Privatization, liberalization, and globalization policies have been beneficial for every country. These policies have ensured that trade can flourish, and the globe has now become borderless when it comes to trade. Countries and their citizens can now enjoy the benefit of having Swiss chocolate with French bread and the United Kingdom’s tea on their dining tables in India. But everything has its own pros and cons. With this variety, it has also become difficult for companies to survive and boom in their own country. Big multinational corporations can take advantage of their capital and expand the market to produce quality ... Read More
Companies have understood that acquiring new consumers is much costlier than retaining old ones. In today’s cutthroat environment, a business can only succeed in the long run when it has a loyal customer base. New companies that can offer similar and sometimes identical products to consumers at a low cost are born every day. Globalization has made the competition even worse. Hence, companies are now becoming the brand of the household by providing the consumer with products that they will need at every stage of their life cycle. In this article, we will be understanding the various family life cycle ... Read More