Go for statement calculate GCD
package main/*www .j a v a2s . c om*/ import "fmt" func gcd(temp1 int,temp2 int){ var gcdnum int for i := 1; i <=temp1 && i <=temp2 ; i++ { if(temp1%i==0 && temp2%i==0) { gcdnum=i } } fmt.Printf("GCD of %d and %d is %d",temp1,temp2,gcdnum) return } func main() { var n1,n2 int n1 = 48 n2 = 24 gcd(n1,n2) }