Programming Articles - Page 569 of 3363

Golang Program to get total bits required for the given number using library function

Akhil Sharma
Updated on 25-Oct-2022 13:05:51

588 Views

In this article we will discuss about how to get total bits required for the given number using library function in Go language. To get the total number of bits of any number we need to represent that number in binary which is a combination of zeroes and ones and then count the number of zeroes and ones. For example: 16 can be converted in binary as 10000 and therefore number of bits in number 16 are 5. 65 can be converted in binary as 1000001 and therefore number of bits in number 65 are 7. Syntax Functions − func ... Read More

Golang Program to get the remainder of float numbers using library function

Akhil Sharma
Updated on 25-Oct-2022 12:58:41

543 Views

In this article we will discuss about how to get the remainder of float numbers using library function in Go language. In programming, a float is a number that has a decimal point in it. For example: 0.2, 5.89, 20.79, etc. Remainder: Remainder in division is defined as the result left after the division process is over. For example, if 4 is the dividend and 2 is the divisor then after dividing 4 with 2 the remainder will be 0. Similarly on dividing 4 with 3 the remainder will be 1. To get the remainder of floating values we can ... Read More

Golang Program to get the Quotient and remainder using library function

Akhil Sharma
Updated on 25-Oct-2022 12:48:33

710 Views

In this article we will discuss about how to get the quotient and remainder in GO language using library function. Syntax func Div(a, b, c uint) (q, r uint) func Remainder(q, r float64) float64 The div() function accepts three arguments as unsigned integers and returns the quotient and remainder respectively after computing the division process. The remainder() function accepts two arguments as 64-bit float values and returns the remainder after performing the division process in the same format. The source code to get the quotient and remainder of division using library functions is compiled and executed below. Finding The ... Read More

Golang Program to Find the Sum of N Numbers using Recursion

Akhil Sharma
Updated on 25-Oct-2022 12:31:17

2K+ Views

In this tutorial, we are going to learn how to find the sum of N Numbers using Recursion in Golang programming language. A Recursion is where a function calls itself by direct or indirect means. Every recursive function has a base case or base condition which is the final executable statement in recursion and halts further calls. Below are two examples showing the two different type of recursion: direct and indirect. Find the Sum of N Numbers by Direct Recursion Method Syntax Syntax for direct recursion func recursion() { recursion() } func main() { ... Read More

Golang Program to Find the Sum of Natural Numbers using Recursion

Akhil Sharma
Updated on 25-Oct-2022 12:21:25

403 Views

In this tutorial, we are going to learn how to find the sum of Natural Numbers using Recursion in Golang. A Recursion is where a function calls itself by direct or indirect means. Every recursive function has a base case or base condition which is the final executable statement in recursion and halts further calls. Below are two examples showing the two different type of recursion: direct and indirect. Find the Sum of Natural numbers by Direct Recursion Method Syntax func recursion() { recursion() } func main() { recursion(); } Algorithm Step ... Read More

Golang Program to Reverse a Sentence using Recursion

Akhil Sharma
Updated on 25-Oct-2022 12:10:12

718 Views

In this tutorial, we will learn how to reverse a sentence using recursion in Go Programming Language. A Recursion is where a function calls itself by direct or indirect means. Every recursive function has a base case or base condition which is the final executable statement in recursion and halts further calls. The recursion continues until some condition is met to prevent it. Below are two examples showing the two different type of recursion: direct and indirect. Reverse a Sentence using Recursion by using Direct Recursion Method Syntax Func recursion() { recursion(); /* function calls itself */ ... Read More

Golang Program to make a Simple Calculator using Switch Case

Akhil Sharma
Updated on 28-Oct-2022 07:58:28

5K+ Views

In this tutorial we will see how to make a simple calculator using switch case statements in Go programming language. The switch statement will assess an expression, comparing the expression's value against a series of case conditions given in a series and executes the statement after the first condition with a matching value, until a break is encountered. Golang Basic switch case with default A switch statement runs the first case equal to the choice entered. The cases are evaluated in an order and it stops when a case succeeds. If no case (choice entered) matches, it is a ... Read More

Golang Program to Create a Function without Argument and Without a Return Value

Akhil Sharma
Updated on 25-Oct-2022 11:41:08

2K+ Views

In this tutorial we will learn how to create a function without argument and without a return value in Go Programming Language. When a function has no arguments, it does not receive any data from the calling function. Similarly when it does not return any value, the calling function does not receive any data from the called function. So there is no data transfer between calling and called function. Add two Numbers Algorithm Step 1 − Import the package fmt package Step 2 − Start function main () Step 3 − Calling the function add () Step 4 − ... Read More

Golang Program to Find G.C.D Using Recursion

Akhil Sharma
Updated on 25-Oct-2022 11:34:00

1K+ Views

In this tutorial we will discuss how to write a Golang program to find the greatest common divisor GCD using recursion. The greatest common divisor (GCD) of two or more numbers is the greatest common factor number that divides them, exactly. It is also called the highest common factor (HCF). For example, the greatest common factor of 15 and 10 is 5, since both the numbers can be divided by 5. 15/5 = 3 10/5 = 2 Algorithm Step 1 − Import the package fmt Step 2 − Start function main() Step 3 − We will use an ... Read More

How to add multiple graphs to a Plotly Dash app on a single browser page in Python Plotly?

Vani Nalliappan
Updated on 21-Oct-2022 09:37:33

5K+ Views

Plotly is an open-source plotting library in Python that can generate several different types of charts. Python users can use Plotly to create interactive web-based visualizations that can be displayed in Jupyter notebooks, saved to standalone HTML files, or served as a part of web applications using Dash. Plotly can also be used in static document publishing and desktop editors such as PyCharm and Spyder. Dash is a Python framework and it is used to create interactive web-based dashboard applications. The dash library adds all the required libraries to web based dashboard applications. In this tutorial, we will show how ... Read More

Advertisements