
Data Structure
Networking
RDBMS
Operating System
Java
MS Excel
iOS
HTML
CSS
Android
Python
C Programming
C++
C#
MongoDB
MySQL
Javascript
PHP
- Selected Reading
- UPSC IAS Exams Notes
- Developer's Best Practices
- Questions and Answers
- Effective Resume Writing
- HR Interview Questions
- Computer Glossary
- Who is Who
Found 33676 Articles for Programming

5K+ Views
In Golang, there are various methods to get characters from a string with the help of an index. In this article, we are using external functions as well as by using internal functions defined in the go language. Method 1: Using User-Defined Function In this method, the function that we create will take the string whose character is to be determined along with the integer type index of the string and will return the character of the string present at that index. Algorithm Step 1 − First, we need to import the fmt package. Step 2 − Then, create ... Read More

2K+ Views
What is string in golang? In Go, a string is a sequence of characters. It is an immutable data type, meaning that once a string is created, it cannot be modified. Strings are enclosed in double quotes ("") and can contain any combination of letters, numbers, and symbols. They are commonly used to store text and are often used as input and output in programs. Method 1: By Using An External Function In this method, the function that we create will accept the string whose length is to be calculated as an argument and returns the final length of the ... Read More

365 Views
An Armstrong number, also known as a narcissistic number, is a number that is equal to the sum of its own digits each raised to the power of the number of digits. Here we will show different approaches about how we can print the Armstrong numbers in go programming language. Method 1: By Using Math Package In this example we will use different functions present in math package in order to print the Armstrong numbers between said limits. Syntax func Pow(a, b float64) float64 The pow() function is present in math package and is used to raise one number ... Read More

589 Views
In go language, a long is not a separate data type but it is an extension made from the integer data type to store even larger values of integers. The main difference between an int data type and long data type is that an int data type is 32 bits whereas long data type is 64 bits. Here we will learn about different techniques to convert long types variables to int using go programming language. Method 1: By Using Type Casting In this example we will use the type casting approach to convert the long data type variables to int. ... Read More

1K+ Views
In this tutorial, we will see to write a go language program to find distinct 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

1K+ Views
In this article we will write a go language program to find the index of the first occurrence of the specified item in an array. we will use for loops and inbuilt go library functions to achieve the result. Method 1: Using SearchInts() Library Function Syntax func Sort(data Interface) The sort() function is present in sort package. this function is used to sort an array in ascending order. The array to be sorted is passed as an argument to the function. The time complexity of this function is O(n * logn). type IntSlice []int The IntSlice() function is ... Read More

1K+ Views
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

3K+ Views
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

10K+ Views
A substring in Go is a portion of a larger string. It is specified by providing a start index and a length, and it contains the characters of the original string starting at the start index and going up to the specified length. The characters in a substring are still a part of the original string and share the same memory. In Go, a string is a sequence of characters. It is an immutable data type, meaning that once a string is created, it cannot be modified. Strings are enclosed in double quotes ("") and can contain any combination of ... Read More

421 Views
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