Golang Program to Generate all the Divisors of an Integer

prashanth nallla
Published on 31-Jul-2021 15:29:02
StepsTake the value of the integer and store it in a variable.Use a for loop and an if statement to generate the divisors of the integer.Print the divisors of the number.Enter an integer:25The divisors of the number are:1525The divisors of the number are: 2012451020ExplanationUser must first enter the value and ... Read More

Golang Program to Take the Temperature in Celsius and Covert it to Farenheit

Rishikesh Kumar Rishi
Published on 31-Jul-2021 15:27:49
StepsTake the value of temperature in Celsius and store it in a variable.Convert it to Fahrenheit.Print the final result.Enter the temperature in Celsius: 32Temperature in Fahrenheit is: 89.6Enter the temperature in Celsius: 48Temperature in Fahrenheit is: 118.4ExplanationUser must first enter the value of temperature in Celsius.Using the formula: f=(c*1.8)+32, convert ... Read More

Golang Program to Convert Centimeters into Feet and Inches

Rishikesh Kumar Rishi
Published on 31-Jul-2021 15:26:45
StepsTake the height in centimeters and store it in a variable.Convert the height in centimeters into inches and feet.Print the length in inches and feet.Enter the height in centimeters: 50The length in inches: 19.7The length in feet: 1.64Enter the height in centimeters: 153The length in inches: 60.28The length in feet: ... Read More

Golang Program to Check Whether a Given Year is a Leap Year

Rishikesh Kumar Rishi
Published on 31-Jul-2021 15:25:14
StepsTake the value of the year as input.Using an if-statement, check whether the year is a leap year or notPrint the final result.Enter the year to be checked: 2016The year is a leap year!Enter the year to be checked: 2005The year isn't a leap year!ExplanationUser must first enter the year ... Read More

Golang Program to Compute Simple Interest Given all the Required Values

Rishikesh Kumar Rishi
Published on 31-Jul-2021 15:07:53
StepsRead the values for principal amount, rate and time.Using the formula, compute the simple interest.Print the value for the computed interest.Enter the principal amount: 200Enter the time(years): 5Enter the rate: 5The simple interest is: 50Enter the principal amount: 70000Enter the time(years): 1Enter the rate: 4The simple interest is: 2800ExplanationUser must ... Read More

Golang Program to Print an Inverted Star Pattern

Rishikesh Kumar Rishi
Published on 31-Jul-2021 15:15:35
StepsTake a value from the user and store it in a variable, n.Use a for loop where the value of i ranges between the values of n-1 and 0 with a decrement of 1 with each iteration.Multiply the empty spaces with n-i and '*' with i and print both of ... Read More

Golang Program to Print an Identity Matrix

Rishikesh Kumar Rishi
Published on 31-Jul-2021 15:06:42
The steps to print an identity matrix using Golang is as follows :Take a value from the user and store it in a variable, n.Use two for loops where the value of j ranges between the values of 0 and n-1 and the value of i also ranges between 0 ... Read More

Golang Program to Read a Number (n) and Print the Natural Numbers Summation Pattern

Rishikesh Kumar Rishi
Published on 31-Jul-2021 15:05:26
Let's suppose the number is: 4Then, the Summation Patten would be:1 = 11 + 2 = 31 + 2 + 3 = 61 + 2 + 3 + 4 = 10StepsTake a value from the user and store it in a variable, n.Use two for loops where the value of ... Read More

Goland Program to Read a Number (n) And Print the Series "1+2+…..+n= "

Rishikesh Kumar Rishi
Published on 31-Jul-2021 15:04:23
StepsTake a value from the user and store it in a variable (n).Use a for loop where the value of i ranges between the values of 1 and n.Print the value of i and '+' operator.Find the sum of elements in the list.Print '=' followed by the total sum.Exit.ExplanationUser must ... Read More

Golang Program to print all integers between a range that aren't divisible by either 2 or 3

Rishikesh Kumar Rishi
Published on 31-Jul-2021 14:59:41
Let's assume the range is from 0 to 50. We have to print all the integers that aren't divisible by either 2 or 3.StepsUse a for loop ranging from 0 to 50.Then, use an if statement to check if the number isn't divisible by both 2 and 3.Print the numbers ... Read More
Advertisements