Calculate Simple Interest Using Golang Code

Aman Sharma
Updated on 29-Aug-2022 07:16:52

600 Views

In this tutorial, we are going to see the program for calculating simple interest in Golang. It is a method of finding the interest on loans in the banking and finance sector using some factors like principal amount, rate per annum, and time. Formula simple_Interest = ( p * r * t) / 100P = Principal amountR = Rate per annumT = Time For example, suppose the principal amount is 1000, the rate of interest is 4 and the interval is 2 years then the simple interest is. Simple_interest = (1000 * 4 * 2) / 100 ... Read More

Find Factorial of a Number in Golang

Aman Sharma
Updated on 29-Aug-2022 06:55:21

4K+ Views

In this tutorial, we are going to write and explain the code to find the factorial of a number in Golang. The factorial is the multiplication of the number with all the numbers less than it. In this tutorial, we will see two ways to find the factorial in Golang. One is by creating a recursive function. Second, by using the for a loop. For example, the factorial of 5 is: 5! = 5 * 4 * 3 * 2 * 1 = 120 A recursive approach to finding the factorial of a number Algorithm STEP 1 − ... Read More

Check If a Number Is a Neon Number in Golang

Aman Sharma
Updated on 29-Aug-2022 06:49:28

314 Views

In this tutorial, we are going to write and explain the code to check whether the given number is a neon number or not. The Neon number is a number that is equal to the sum of all the digits of its square. For example, 9 is a neon number as shown below The square of 9 is: 9 * 9 = 81 The sum of each digit of the square i.e 81 is 9 and the number is also 9 so 9 is a Neon number. Algorithm STEP 1 − First we are declaring the numbers between ... Read More

Check Armstrong Number Between Two Integers in Golang

Aman Sharma
Updated on 29-Aug-2022 06:39:34

284 Views

In this tutorial, we are going to write and explain the code for finding the Armstrong number between two integers. The Armstrong number is a number whose sum of the cube of all the digits in the number is equal to the number itself. For example, 153 is a number as shown below 153 = 1^3 + 5^3 + 3^3 = 1 + 125 + 27 = 153 Algorithm STEP 1 − First we are declaring the numbers between which we have to find the Armstrong Numbers. STEP 2 − Now, we ... Read More

JavaScript Standard for Commenting Functions

Sravani Alamanda
Updated on 26-Aug-2022 14:42:50

299 Views

Comments are used to explain the code flow and want to prevent the code from executing. In JavaScript, there are two types of comments. One is single-line comments, used to comment on the single-line code to prevent the code from executing or to explain the code. Another one is multi-line comments, used to comment on blocks of code to prevent the code from the execution or to explain code that is added in or code. By adding comments, we will give clarity to other developers also why code is added and what that particular code will do. Commented code will ... Read More

Use HTML Comments on Blocks of JavaScript

Sravani Alamanda
Updated on 26-Aug-2022 14:41:42

179 Views

No, it is not recommended to use HTML comments to comment blocks of code. When JavaScript has first released some browsers didn’t have any support to understand the script. So a technique was then needed to hide the script code for older browsers. So that time the HTML comment within the JavaScript block was used to prevent the older browsers from showing the script code as text on the page. This technique was followed in the 1990s. Such browsers do not exist now, which wanted you to use HTML comments in JavaScript. Now all browsers understand the JavaScript blocks, so ... Read More

Remove Last Array Element in JavaScript and Return It

Shubham Vora
Updated on 26-Aug-2022 14:17:28

15K+ Views

In this tutorial, we will learn how to remove the last array element in JavaScript and return it. In JavaScript, arrays are described as list-like objects. A single array object can store multiple values. An array object is stored in a variable. Array elements are stored in a memory location. Each array element is identified by its index value. You must process an array by inserting an element, removing or changing, etc. JavaScript has a lot of methods to update an array. Let us look at various ways to remove the last array element in JavaScript. Following are the Methods/Functions ... Read More

Handle and Bind Events Using JavaScript

Shubham Vora
Updated on 26-Aug-2022 13:35:20

10K+ Views

In this tutorial, we will learn how to handle bind an event using JavaScript. Events are the actions or occurrences in the system by the browser or users. There are various types of events that represent various activities performed by the browser or users. For example, if a user clicks on a button, it triggers an event named "click." Similarly, if a webpage finished loading, it triggered an event called "load." An Event Listener is a program that continuously listens to or waits for an event to occur. It is one of the most important parts of JavaScript. The ... Read More

Get Number of Options in Dropdown List with JavaScript

Shubham Vora
Updated on 26-Aug-2022 13:25:34

10K+ Views

This tutorial will show different ways to get the number of options in the drop-down list with JavaScript. While filling out any form online, users have to add unique information using the input method. However, the options they get in the drop-down list are already determined. Since there can be limited options mentioned in the drop-down, you might have to check the number using JavaScript. Using options.length method to get the number of drop-down options One of the simple ways to get access to the list of options is to get the list by its Id. We will use a ... Read More

Get the Square Root of 2 in JavaScript

Shubham Vora
Updated on 26-Aug-2022 13:20:46

1K+ Views

In this tutorial, we shall learn to get the square root of 2 in JavaScript. The square root of 2 is an irrational number, and it is called Pythagoras's constant. We can’t denote it in fractions, and it has an infinite number of decimals; hence, we can’t find its exact value. The √2 value is 1.414. HTML encoding of the square root symbol in JavaScript is √. Next, we will discuss the available method to find the square root of 2. Using Math object's SQRT2 property In this part, we will see how the SQRT2 property of the Math object ... Read More

Advertisements