prashanth nallla

prashanth nallla

1 Articles Published

Articles by prashanth nallla

1 articles

Golang Program to Generate all the Divisors of an Integer

prashanth nallla
prashanth nallla
Updated on 31-Jul-2021 747 Views

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 store it in a variable.Use a for loop to generate numbers from 1 to n.Using an if statement, check if the number divided by i gives the remainder as 0 which is basically the divisor of the integer.Print the divisors of the number.Example Live Demopackage main import "fmt" func main(){   ...

Read More
Showing 1–1 of 1 articles
« Prev 1 Next »
Advertisements