Rishikesh Kumar Rishi has Published 1162 Articles

Golang Program to Print the Largest Even and Largest Odd Number in a List

Rishikesh Kumar Rishi

Rishikesh Kumar Rishi

Updated on 31-Jul-2021 15:47:15

425 Views

Enter the number of elements to be in the list: 5Element: 45Element: 20Element: 80Element: 93Element: 3Largest even number: 80Largest odd number 93Enter the number of elements to be in the list: 4Element: 23Element: 10Element: 34Element: 89Largest even number: 34Largest odd number 89StepsEnter the number of elements of to be in ... Read More

Golang Program to Print the Sum of all the Positive Numbers and Negative Numbers in a List

Rishikesh Kumar Rishi

Rishikesh Kumar Rishi

Updated on 31-Jul-2021 15:45:21

261 Views

StepsRead a number of elements to be in a list.Take the elements from the user using a for loop and append to a list.Using a for loop, get the elements one by one from the list and check if it is positive or negative.If it is positive, check if it ... Read More

Golang Program to Print the Multiplication Table of a Given Number

Rishikesh Kumar Rishi

Rishikesh Kumar Rishi

Updated on 31-Jul-2021 15:35:29

881 Views

StepsRead a number and store it in a variable.Print the multiplication table of the given number.Enter the number to print the table for: 77 x 1 = 77 x 2 = 147 x 3 = 217 x 4 = 287 x 5 = 357 x 6 = 427 x 7 ... Read More

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

Rishikesh Kumar Rishi

Rishikesh Kumar Rishi

Updated on 31-Jul-2021 15:33:13

386 Views

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

Rishikesh Kumar Rishi

Updated on 31-Jul-2021 15:32:26

215 Views

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

Rishikesh Kumar Rishi

Updated on 31-Jul-2021 15:31:40

1K+ Views

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 Print an Inverted Star Pattern

Rishikesh Kumar Rishi

Rishikesh Kumar Rishi

Updated on 31-Jul-2021 15:30:43

238 Views

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 Compute Simple Interest Given all the Required Values

Rishikesh Kumar Rishi

Rishikesh Kumar Rishi

Updated on 31-Jul-2021 15:11:05

100 Views

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 Identity Matrix

Rishikesh Kumar Rishi

Rishikesh Kumar Rishi

Updated on 31-Jul-2021 15:09:29

169 Views

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

Rishikesh Kumar Rishi

Updated on 31-Jul-2021 15:07:59

201 Views

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

Advertisements