Go for statement Find Largest Array Element

Description

Go for statement Find Largest Array Element

package main//from  w w w . ja v a2s  .c om

import "fmt"

func main(){
  var num[100] float64
  var temp int

  for i := 0; i < 10; i++ {
    num[i] = float64(i) * float64(i)
  }
  
    for j := 1; j < temp; j++ {
    if( num[0] < num[j] ) {
        num[0] = num[j]
    }
  }

  fmt.Print("The largest number is : ",num[0])

}



PreviousNext

Related