Found 26504 Articles for Server Side Programming

Golang Program to Calculate Standard Deviation

Akhil Sharma
Updated on 28-Dec-2022 16:28:28

2K+ Views

In this tutorial, we will write a go language code to calculate the standard deviation. The standard deviation is a statistic that expresses how much variance or dispersion there is in a group of numbers. It is calculated as the square root of the mean. Find the Standard Deviation Using External Functions In this example, we will write a go language program to calculate the standard deviation using user-defined functions. Algorithm to the Above Program Step 1 − Import the fmt, math, and start. Step 2 − Create the standardDeviation() function. This function uses a for loop to intend ... Read More

Golang Program to Add Two Matrix Using Multi-dimensional Arrays

Akhil Sharma
Updated on 28-Dec-2022 16:23:57

618 Views

In this tutorial, we will write a go language program to add two matrices. The difference between a single-dimension array and a multidimensional array is that the former holds an attribute while the latter holds another array on the index. Additionally, every element of a multidimensional array will have the same data type. Adding Two Matrices Using Loops Let us now look at a go language program to add two matrices using loops. Algorithm to the Above Program Step 1 − Import the fmt package. Step 2 − Now we need to start the main() function. Step 3 ... Read More

Golang Program To Add Two Matrices

Akhil Sharma
Updated on 28-Dec-2022 16:14:39

1K+ Views

In this tutorial, we will write a go language program to add two matrices. A matrix is a collection of numbers that are arranged in rows and columns, which is a two-dimensional array. Go Language Program To Add Two Matrices Let us now look at a go language program to add two matrices using loops. Algorithm to the Above Program Step 1 − Import the fmt package. Step 2 − Now we need to start the main() function. Step 3 − Then we are creating two matrices named matrixA and matrixB and store values in them. Step 4 − Print ... Read More

Golang Program For Array Rotation

Akhil Sharma
Updated on 28-Dec-2022 15:58:03

1K+ Views

Introduction In this tutorial, we will see to write a go language program to rotate an array. We will write two programs for this. One to rotate the array to left and another to rotate it to right. Golang Program to Rotate an Array to Left The following code illustrates how we can rotate an array to left using a user defined function. Algorithm to the above Program Step 1 − Import the fmt package that allows us to print anything on the screen. Step 2 − Create a function named rotateLeft() which returns the final array after rotating it. ... Read More

Golang program to print a 2D array?

Saumya Srivastava
Updated on 28-Dec-2022 12:10:20

1K+ Views

Two−dimensional arrays are commonly used in Go. For example, storing data in a table requires a 2D array. In this tutorial, we will be discussing the approach to printing a 2D array in Golang programming. But before writing this code, let’s briefly discuss the two−dimensional array. What is a 2D Array? A 2D array is comprised of rows and columns. Its nature is similar to a normal array with a fixed length. It is homogeneous in nature, i.e., all the elements stored in a 2D array should be of the same data type. If a 2D array has ‘r’ rows ... Read More

Golang program to print an array?

Saumya Srivastava
Updated on 28-Dec-2022 12:06:41

4K+ Views

Data plays an essential role when we write programs. It can be stored in multiple ways. For storing a collection of data with the same data type, an array can be used. In this tutorial, we will be discussing the approach to printing an array in Golang programming. But before writing the code for this, let’s briefly discuss the array. What is an Array? An array has a fixed length and its length cannot be altered. It is homogeneous in nature, i.e., all the elements stored in an array should be of the same data type. If an array has ... Read More

Golang Program to Create a Simple Class?

Saumya Srivastava
Updated on 28-Dec-2022 11:58:59

935 Views

In this tutorial, we will be discussing the approach to creating a simple class in Golang programming. However, before writing the code for this, let’s briefly discuss the concept of class. What is Class? A class is a template or blueprint for creating objects. A class binds together all the elements of a program and it is an essential part of object−oriented programming. Nevertheless, Go language does not support the ‘class’ keyword unlike other languages like Java, C++, etc. which are object−oriented languages. However, this does not limit Go to using the functionality of a class. Go keeps up with ... Read More

Golang program to Calculate the Volume, Diagonal and Area of a Cuboid?

Saumya Srivastava
Updated on 28-Dec-2022 12:18:31

315 Views

In this tutorial, we will discuss the approach to calculating the volume, diagonal and area of a cuboid using its length, breadth and height. But before writing its Golang code, let’s briefly discuss the cuboid and its volume, diagonal and area. Cuboid A cuboid is a three−dimensional figure with six faces and twelve edges. The length, breadth, and height of a cuboid are different unlike a cube whose all sides are equal. A rectangular box is a good example of a cuboid. Volume of a Cuboid The amount of space a cuboid occupies is termed its volume. Calculating the volume ... Read More

Explain Enum in TypeScript

Shubham Vora
Updated on 03-Jan-2023 11:39:00

560 Views

Before getting into “enum, ” it is essential to know about the popular keyword “const” in typescript. When we declare a variable "const", we cannot change the value assigned to it. So, enums are nothing but a collection of these const data types. We can create enums with the help of the "enum" keyword. Enum is an abbreviation for Enumerations, and each constant variable declared under the enum is called a member of that enum. In this article, we will learn about enums in typescript, their features, and the major types of enums. Features of enum in TypeScript Enums ... Read More

JAVA Program to Replace Element of Integer Array with Product of Other Elements

Mr. Satyabrata
Updated on 30-Dec-2022 14:00:34

4K+ Views

Array of Integers refers to an array where all the elements are of Integer type. It is alsocalled an Integer array. As per the problem statement we have to create an Integer array and display the array elements where all the array elements are the product of other elements of the array. In this article, we will see how to replace array elements by the product of other array elements by using Java programming language. To show you some instances − Instance-1 int arr[] = { 2, 3, 1, 4, 6 } At Index-0 value will be = 3 * ... Read More

Advertisements