Found 1082 Articles for Go Programming

How to Find the Perimeter of a Circle in Golang?

Aman Sharma
Updated on 02-Sep-2022 13:08:16

170 Views

In this tutorial, we are going to see the Golang program to find the perimeter of a Circle. Perimeter is the total length of the boundary of any closed figure. Formula Perimeter of Circle - 2 * 22 / 7 * r r - radius of a Circle For example, the radius of a Circle is 10 cm so the perimeter of a Circle is − perimeter = 2 * 22 / 7 * 10 = 62.8571428 Finding the perimeter of a circle within the function Algorithm Step 1 − Declaring the variables for ... Read More

How To Find The Area of a Trapezium in Golang?

Aman Sharma
Updated on 02-Sep-2022 13:06:14

129 Views

In this tutorial, we are going to see the Golang program to find the Area of a Trapezium. The area is the total space covered by any closed figure. Formula Area of Trapezium - ½ * (b1 + b2) * h b1 - length of one parallel side of a Trapezium b2 - length of another parallel side of a Trapezium h - the distance between the parallel sides of a Trapezium. For example, the length of one parallel side of a Trapezium is 10 cm and the other parallel side is 8 cm, and the distance between ... Read More

How To Find The Area of a Parallelogram in Golang?

Aman Sharma
Updated on 02-Sep-2022 13:00:54

97 Views

In this tutorial, we are going to see the Golang program to find the Area of a Parallelogram. The area is the total space covered by any closed figure. Formula Area of the Parallelogram - base * height b - length of the base of a Parallelogram h - length of the height of a Parallelogram For example, the length of the base of a Parallelogram is 6 cm and the length of the height of the parallelogram is 4 cm so the Area of a Parallelogram is − b = 6 cm h = 4 cm Area ... Read More

How to Find Area of Square in Golang?

Aman Sharma
Updated on 02-Sep-2022 12:57:39

286 Views

In this tutorial, we are going to see the Golang program to find the Area of a Square. The area is the total space covered by any closed figure. Formula Area of Square - (length of a side) * (length of a side) s - length of a side of a Square For example, the length of a side of a Square is 10 cm so the Area of a Square is − Area = 10 * 10 = 100 cm^2 Finding the Area of a Square within the function Algorithm Step ... Read More

How to Count the Number of Vowels and Consonants in a Sentence in Golang?

Aman Sharma
Updated on 02-Sep-2022 12:54:10

596 Views

In this tutorial, we are going to see how to find the number of vowels and consonants in a sentence in Golang. If any character lies under the set {a, e, i, o , u} then that character is a vowel. Any character that does not lie in the above set is a consonant. Explanation Suppose we have a sentence “India have twenty eight states and eight union territories”. In this sentence, the characters which are bold are the vowels. So, the total vowels are 21 and consonants are 29. Finding the count of vowels and consonants within the function ... Read More

How to Calculate the Sum of Natural Numbers in Golang?

Aman Sharma
Updated on 02-Sep-2022 12:50:10

918 Views

In this tutorial, we are going to see how to find the sum of Natural Numbers in Golang. To do that we have two ways one using the formula itself and the other is to use a for loop we will explore both ways in this tutorial. Formula Sum = ( N * ( N + 1))/2 N = The value of the natural number till which you want to find the sum. Explanation Let's find the sum of the first 6 natural numbers using the above formula. Sum of first 6 natural numbers = 1 + 2 + ... Read More

How to Find the Largest Among Three Numbers in the Golang program?

Aman Sharma
Updated on 29-Aug-2022 08:35:25

789 Views

In this tutorial, we are going to see how to find the largest number among the given number in Golang. This tutorial will cover two ways to do the same thing. Explanation Suppose we have three numbers 33, 76, and 47 so we can observe that 76 > 33 76 > 47 So our Golang code should print 76 as the largest number. Defining the operation within Same Funtion Algorithm Step 1 − Declaring the variables for the number1, number2, number3, and largest of int32 data type. Step 2 − Taking the input for the number1, number2, and ... Read More

How to Compute Quotient and Remainder in Golang?

Aman Sharma
Updated on 29-Aug-2022 08:25:03

838 Views

In this tutorial, we are going to understand the approach to finding the quotient and the remainder by performing the arithmetic operations on the dividend and the divisor provided as input by the user. This tutorial will cover two ways to do the same thing. Explanation To divide any number we use the “ / ” arithmetic operator and to find the remainder we use the “ % ” arithmetic operator Suppose we have a dividend 19 and a divisor 4 then the quotient and the remainder are as follows: Quotient = dividend / divisor = 19 ... Read More

How to print the ASCII values in Golang?

Aman Sharma
Updated on 29-Aug-2022 08:08:07

5K+ Views

In this tutorial, we are going to learn how to find and print the ASCII value of any character or symbol in Golang. The ASCII stands for American Standard Code for Information Exchange which is a way to represent the characters, and symbols in numeric form. Printing the ASCII value using specifier Algorithm STEP 1 − Declaring the variable of string type STEP 2 − Initializing the variable. STEP 3 − Running the for loop which is printing the ASCII value for each element in the string. Example 1 In this example, we are going to print the ASCII ... Read More

How to find the Area of a Circle in Golang?

Aman Sharma
Updated on 29-Aug-2022 07:59:21

542 Views

In this tutorial, we are going to see the Golang program to find the Area of a Circle. The area is the total space covered by any closed figure. Formula Area of Circle - 22 / 7 * r * r r - radius of a Circle For example, the radius of a Circle is 10 cm so the Area of a Circle is − Area = 22 / 7 * 10 * 10 = 4.2857142857143 Finding the Area of a circle within the function Algorithm STEP 1 − Declaring the variables for the ... Read More

Advertisements