Go Arithmetic Operators calculate LCM
package main/*from w ww. j a v a 2s.com*/ import "fmt" func lcm(temp1 int,temp2 int) { var lcmnum int =1 if(temp1>temp2) { lcmnum=temp1 }else{ lcmnum=temp2 } for { if(lcmnum%temp1==0 && lcmnum%temp2==0) { fmt.Printf("LCM of %d and %d is %d",temp1,temp2,lcmnum) break } lcmnum++ } return // Return without any value } func main() { var n1,n2 int n1 = 48 n2 = 24 lcm(n1,n2) }