Server Side Programming Articles - Page 491 of 2650

How to add Two Binary Strings in Golang?

Aman Sharma
Updated on 26-Aug-2022 08:25:40

2K+ Views

This tutorial will show how we can add two binary strings in Golang. Also, we will cover and understand all the cases while adding two strings using examples. Example Suppose we want to add these two binary strings “111” and “1011” whose numeric values are 7 and 11 whose addition is 18 with binary representation “10010”. Now we will do the addition of these strings step by step below.variables with the respective values you want to multiply. As you can see the length of string “111” is less than “1011” so we have to make them equal for which ... Read More

How to Multiply Two Floating-Point Numbers in Golang?

Aman Sharma
Updated on 26-Aug-2022 08:04:03

1K+ Views

This tutorial will show how to multiply two float numbers within a function or by creating a separate function and calling it in the current function. Multiplying two float numbers within the function Algorithm STEP 1 − Defining the floating variables that we want to multiply and the floating variable in which we will add the result. STEP 2 − Initialize the variables with the respective values you want to multiply. STEP 3 − Multiply two numbers and store them in the third variable. STEP 4 − Print the result after multiplying two numbers. Example package main ... Read More

How to Add Two Numbers in Golang?

Aman Sharma
Updated on 26-Aug-2022 08:00:01

6K+ Views

In this tutorial, we will discuss adding two numbers in Golang. We will cover two approaches first adding two numbers within the function and second creating a different function. Adding two numbers within the function Algorithm STEP 1 − Defining the variables that we want to add. STEP 2 − Initializing the variables. STEP 3 − Add two numbers and store them in the third variable. STEP 4 − Print the result after adding two numbers. Example 1 In this example, we will add two integers within the function. package main // fmt package provides the function ... Read More

How to print a string in Golang?

Aman Sharma
Updated on 26-Aug-2022 07:46:44

13K+ Views

In this tutorial, we will learn how to print a string in the Golang programming language. To print a string in Golang we have to use the package fmt which contains the input/output functions. The correct specifier tells the data type of variable we are printing. The specifiers we can use to print the strings are: %s − By using this we can print the uninterpreted strings or slice. %q − By using this we can print the string with double quotes. %x − By using this we can print the lower case character string with base 16. %X − By using this ... Read More

Built-in functions supported by dictionary view objects

Govind
Updated on 25-Aug-2022 11:38:58

519 Views

The dictionary view objects include dict.keys(), dict.values(), dict.items(). They are used to obtain the dynamic view of the dictionary elements in python. These objects reflect the changes made to the dictionary. To retrieve some data or perform various operations on these view objects, there are 5 build-in functions in python that are supported. They are as follows − len(obj) iter(obj) reversed(obj) sorted(obj) ist(obj) We will discuss about all the functions mentioned above in this article. The len(obj) method The len(obj) method takes a view object as a parameter and returns the number of items in the dictionary. Example ... Read More

Swift Program to find the tangent of given radian value

Ankita Saini
Updated on 26-Aug-2022 11:36:09

252 Views

This tutorial will discuss how to write a Swift program to find the tangent of given radian value. A tangent function is used to define the ratio of the length of the opposite side to the adjacent side in the right-angled triangle. It is also known as the tan function. The mathematical representation of the tangent() function is − tan() = opposite side/adjacent Side In Swift, we can calculate the tangent of the given radian value using the pre-defined tan() function. This function returns the tangent value of the specified number. Here, the specified number represent an angle. Syntax ... Read More

Swift Program to find the cosine of given radian value

Ankita Saini
Updated on 25-Aug-2022 09:02:20

516 Views

This tutorial will discuss how to write a Swift program to find the cosine of given radian value. A cosine function is used to define the ratio of the length of the adjacent side to the hypotenuse in the right-angled triangle. It is also known as the cos function. The mathematical representation of the cosine() function is − cos() = adjacent Side/ hypotenuse In Swift, we can calculate the cosine of the given radian value using the pre-defined cos() function. This function return the cosine value of the specified number between -1 to 1. Here, the specified number represent ... Read More

Swift Program to find the sine of given radian value

Ankita Saini
Updated on 25-Aug-2022 09:01:04

791 Views

This tutorial will discuss how to write a Swift program to find the sine of given radian value. A sine function is used to define the ratio of the length of the opposite side to the hypotenuse in the right-angled triangle. It is also known as the sin function. The mathematical representation of the sine() function is: sin() = opposite Side/ hypotenuse In Swift, we can calculate the sine of the given radian value using the pre-defined sin() function. This function return the sine value of the specified number between -1 to 1. Here, the specified number represents an ... Read More

Swift Program to calculate the volume and area of Sphere

Ankita Saini
Updated on 25-Aug-2022 08:59:43

389 Views

This tutorial will discuss how to write a Swift program to calculate the volume and area of the Sphere. A sphere is a three-dimensional round solid shape or object. Or we can say a sphere is a shape that is defined in three axes: x-axis, y-axis, and z-axis. It does not hold any vertices or edges. Volume of the Sphere The amount of space occupied by a sphere in the three-dimensional plane is known as the volume of a sphere. For example, we want to fill a spherical ball with liquid, so using volume we can calculate the required ... Read More

Swift Program to calculate the volume and area of the Cylinder

Ankita Saini
Updated on 25-Aug-2022 08:56:31

441 Views

This tutorial will discuss how to write a Swift program to calculate the volume and area of the cylinder. A cylinder is a three-dimensional shape that has two identical parallel circular bases joined by a curved surface.Volume of the Cylinder The amount of space occupied by the cylinder in the three-dimensional plane is known as the volume of the cylinder. For example, we want to fill a cylindrical bottle with shampoo, so using volume we can calculate the required amount of shampoo. We can calculate the volume of the cylinder using radius and height of the cylinder. Formula Following is ... Read More

Advertisements