program_mult.go 776 B

1234567891011121314151617181920212223242526272829303132333435363738394041424344454647484950
  1. @target: mips, mipt2
  2. package main;
  3. const (
  4. LIN = 2
  5. COL = 2
  6. )
  7. var (
  8. matrizA [LIN][COL]int
  9. matrizB [LIN][COL]int
  10. matrizR [LIN][COL]int
  11. )
  12. func preenche(){
  13. var k = 1
  14. for i := 0; i < LIN ; i++ {
  15. for j := 0; j < COL ; j++ {
  16. matrizA[i][j] = k
  17. matrizB[i][j] = k
  18. k++
  19. }
  20. }
  21. }
  22. func multiplica() {
  23. var aux = 0
  24. for i := 0; i < LIN; i++ {
  25. for j := 0; j < COL; j++ {
  26. for k := 0; k < LIN; k++ {
  27. aux = aux + (matrizA[i][k] * matrizB[k][j])
  28. }
  29. matrizR[i][j] = aux
  30. aux = 0
  31. }
  32. }
  33. }
  34. func main() {
  35. var (
  36. x int
  37. )
  38. x = x + 2
  39. x = x & 9
  40. x = x | 9
  41. preenche()
  42. multiplica()
  43. return x
  44. }