title: MIPS: Finding average of 5 integers
body: <p><strong>Objective:</strong> Using user input, find the average value using five registers.</p>
  
  <p><strong>Example:</strong> 1 3 2 9 4</p>
  
  <p><strong>Output:</strong> 3</p>
  
  <p>Output is 3 because 3.8 is a decimal and I want it in integers</p>
  
  <p>My goal is to not use array but I am having trouble adding all 5 registers:</p>
  
  <pre><code>.data
     prompt1: .asciiz " Please enter an integer: "
     prompt2: .asciiz " Please enter an integer: "
     prompt3: .asciiz " Please enter an integer: "
     prompt4: .asciiz " Please enter an integer: "
     prompt5: .asciiz " Please enter an integer: "
     result: .asciiz "The average is: "
  
  .text
  main:
     #t0 - hold prompt1
     #t1 - hold prompt2
     #t2 - hold prompt3
     #t3 - hold prompt4
     #t4 - hold prompt5
     #t5 - hold sum from prompt1 to prompt5
     #t6 - hold the average value
  
  
     # Prompt the user to enter integer1.
     li $v0, 4        # syscall to print string
     la $a0, prompt1
     syscall
  
     # Read integer1
     li $v0, 5        # syscall to read an integer
     syscall
     move $t0, $v0        # move number to read into $t0
  
     # Prompt the user to enter integer 2.
     li $v0, 4
     la $a0, prompt2
     syscall
  
     # Read integer2
     li $v0,5
     syscall
     move $t1, $v0
  
     # Prompt the user to enter integer 3.
     li $v0, 4
     la $a0, prompt3
     syscall
  
     # Read integer3
     li $v0,5
     syscall
     move $t2, $v0
  
     # Prompt the user to enter integer 4.
     li $v0, 4
     la $a0, prompt4
     syscall
  
     # Read integer4
     li $v0,5
     syscall
     move $t3, $v0
  
     # Prompt the user to enter integer 5.
     li $v0, 4
     la $a0, prompt5
     syscall
  
     # Read integer5
     li $v0,5
     syscall
     move $t4, $v0
  </code></pre>
  
  <p>the part where I got my error</p>
  
  <pre><code>   # add all integers to $t5
     add $a0, $t0, $t1, $t2, $t3, $t4
     li $v0, 1
     syscall
  </code></pre>
  
  <p>continued...</p>
  
  <pre><code>   # Read the sum
     li $v0, 5
     syscall
     move $t5, $v0
  
     # Divide Sum / count
     div $t5, 5
  
     # retrieve it
     mflo $t6
  
     #print out the average
     move $a0, t6
     li $v0, 1
     la $a0, result
     syscall
  
  exit:
     li $v0, 10
     syscall
  </code></pre>
  
  <p>I get an error message </p>
  
  <blockquote>
    <p>spim:(parser) syntax error on line 71 of ... 'add $a0, $t0, $t1, $t2,
    $t3, $t4</p>
  </blockquote>