Advertisement
Uhuuuyy

len.go

May 24th, 2023
142
0
Never
Not a member of Pastebin yet? Sign Up, it unlocks many cool features!
Go 0.56 KB | Source Code | 0 0
  1. package main
  2.  
  3. import "fmt"
  4.  
  5. // Nah sekarang kalian coba outputkan nilai terakhir dari array/slice dibawah
  6. // manfaatkan syntax len() ya.
  7.  
  8. // Output:
  9. // Panjang array adalah 69
  10. // Nilai terakhir dari array adalah 51
  11.  
  12. func main() {
  13.     array := [69]int{1, 2, 3, 4, 5, 6, 7, 8, 9, 10,
  14.         11, 14, 15, 17, 19, 20, 21, 24, 26, 29,
  15.         71, 84, 85, 87, 19, 20, 61, 24, 56, 52,
  16.         71, 84, 85, 87, 19, 20, 61, 24, 56, 53,
  17.         71, 84, 85, 87, 19, 20, 61, 24, 56, 59,
  18.         71, 84, 85, 87, 19, 20, 61, 24, 56, 51,
  19.         7, 15, 85, 19, 20, 61, 24, 56, 51,
  20.     }
  21.     // TODO: answer here
  22.  
  23. }
Tags: fundweb4
Advertisement
Add Comment
Please, Sign In to add comment
Advertisement