sum all integers in a vector2

sum all integers in a vector2 - % sumIntSquare(4)...

Info iconThis preview shows page 1. Sign up to view the full content.

View Full Document Right Arrow Icon
Sheet1 Page 1 %sumIntSquare (number) -> number %Description: Uses a for loop to find the sum of the squaresof each of the positive integers from 1 to 'finish'. %Examples: % sumIntSquare(3) -> 14
Background image of page 1
This is the end of the preview. Sign up to access the rest of the document.

Unformatted text preview: % sumIntSquare(4) -> 30 % sumIntSquare(10) -> 385 function output = sumIntSquare(finish) output = 0 for num = [1:finish] output = output + num^2 end...
View Full Document

This note was uploaded on 10/23/2009 for the course CISC 106 taught by Professor Mcgeary during the Fall '08 term at University of Delaware.

Ask a homework question - tutors are online