Calculate Volume and Area of a Sphere in Go

Saumya Srivastava
Updated on 21-Nov-2022 06:33:21

300 Views

In this tutorial, we will be discussing the approach to calculate the volume and area of a sphere using its radius in Golang programming. But before writing the code for this, let’s briefly discuss the sphere and its volume and area. Sphere A sphere is a three-dimensional figure whose all points are equidistant from the center. It has no edges and no faces. The radius of the sphere is denoted by ‘r’. A ball is a good example of a sphere. Volume of a sphere The capacity or amount of space a sphere occupies is termed ... Read More

Calculate Volume and Area of a Cone in Golang

Saumya Srivastava
Updated on 21-Nov-2022 06:29:08

314 Views

In this tutorial, we will be discussing the approach to calculate the volume and area of a cone using its height and radius in Golang programming. But before writing the code for this, let’s briefly discuss the cone and its volume and area. Cone A cone is a three-dimensional figure that is pointed at the top and its base is flat and curved. The height of the cone is denoted by ‘h’ and the radius of the flat curved surface is denoted by ‘r’. An ice cream cone is a good example of a cone. $$\mathrm{where\: length \, ... Read More

Calculate Sum of All Odd Numbers Up to N in Golang

Saumya Srivastava
Updated on 21-Nov-2022 06:26:06

571 Views

In this tutorial, we will be discussing the program to find the sum of all odd numbers up to ‘N’ in Golang programming. But before writing the code for this, let’s have a brief discussion on odd numbers. Odd Numbers An odd number is a number that is not completely divisible by 2 and its remainder is always 1 when the number is divided by 2. A simple way to check whether a number is an odd number or not is to check its last digit. If the last digit is 1, 3, 5, 7, or 9, then the number ... Read More

Calculate the Sum of All Even Numbers in Go

Saumya Srivastava
Updated on 21-Nov-2022 06:13:38

462 Views

In this tutorial, we will be discussing the program to find the sum of all even numbers in Golang programming. But before writing the code for this, let’s briefly discuss even numbers. Even Numbers An even number is a number that is completely divisible by 2 and its remainder is always 0. A simple way to check whether a number is an even number or not is to check its last digit. If the last digit is 0, 2, 4, 6, or 8, then the number is said to be an even number. Iterate through the first n even numbers ... Read More

Calculate Area of a Cube in Golang

Saumya Srivastava
Updated on 21-Nov-2022 06:08:19

315 Views

In this tutorial, we will be discussing the approach to finding the surface area of a cube in Golang programming using the sides of the cube. But before writing the code for this, let’s briefly discuss the cube and its area. Cube A cube is a three-dimensional figure that has six square faces. All six faces of the cube are in the shape of a square. Its length, breadth, and height are equal. Dice is a common example of a cube. Area of a cube The total area enclosed by all six faces of the cube is known as the ... Read More

Working of Different Layers in Computer Network

Ayushi Bhargava
Updated on 21-Nov-2022 05:36:17

377 Views

Have you ever wondered how different layers of the network work together to send messages? Before going into details, let us first understand some basic terms.Address Resolution Protocol (ARP) request is a protocol that converts IP addresses to MAC addresses.A routing table  is a set of rules, usually displayed in tabular format, used to determine the routing location of data packets transmitted over an Internet Protocol (IP) network.In a typical network, the host device or main computer has all the layers and on the other hand, the router has a network, data link layer and a physical layer.ExampleAssuming that we ... Read More

Understand JavaScript Module Pattern

Lokesh Badavath
Updated on 18-Nov-2022 12:05:07

275 Views

In this article we are going to learn how to understand JavaScript module pattern. The Module pattern is used to copy the concept of classes, so that we can store both public and private methods and variables inside a single object. Since JavaScript doesn’t support classes, similar to classes that are used in other programming languages like Java or Python. Why use modules? Maintainability − A module is self-contained and aims to lessen the dependencies, so that it can grow and improve independently. Name spacing − In JavaScript, variables outside the scope of a top-level function are global. Because ... Read More

Iterate JavaScript Object's Properties Using jQuery

Lokesh Badavath
Updated on 18-Nov-2022 12:00:20

2K+ Views

In this article, we are going to learn how to iterate a JavaScript object’s properties using jQuery. The simplest way to iterate over an object with JavaScript is to use a for in loop. The for statement will iterate over the objects as an array, but the loop will send the key to the object instead of an index as a parameter. This loop is used to iterate over all non-Symbol iterative properties of an object. The hasOwnProperty() method can be used to check if the property belongs to the object itself. The value of each key of the ... Read More

JavaScript Drag and Drop for Touch Devices

Lokesh Badavath
Updated on 18-Nov-2022 11:54:51

5K+ Views

In this article, we are going to discuss how to work with JavaScript Drag and drop for touch devices in JavaScript. Using JavaScript, we can only drag an image and some text. To drag an image, we simply hold the mouse button down and then move it. To drag the text, we need to highlight some text and drag it in the same way as image. HTML5 specifies almost all elements can be draggable. To make an element draggable, we add the draggable property with the value of true to its HTML element tag. Syntax Following is the syntax ... Read More

Secretly Copy to Clipboard using JavaScript in Chrome and Firefox

Lokesh Badavath
Updated on 18-Nov-2022 11:47:34

1K+ Views

In this article we are going to try how to secretly copy a JavaScript function to the clipboard. We use the copytext() method to secretly copy JavaScript function to the clipboard. These functions work on JavaScript console as well. To understand better let’s look into the examples one by one. Example Following is the example program we used copyText() method to copy text to clipboard using JavaScript function. Copy text ... Read More

Advertisements