×

### Let's log you in.

or

Don't have a StudySoup account? Create one here!

×

or

## Programming Exam Notes

by: Neha Bhagirath

19

0

4

# Programming Exam Notes BE1500

Neha Bhagirath
WSU

Get a free preview of these Notes, just enter your email below.

×
Unlock Preview

These are notes for the second midterm
COURSE
Intro to Programming
PROF.
TYPE
Study Guide
PAGES
4
WORDS
KARMA
50 ?

## Popular in Engineering and Tech

This 4 page Study Guide was uploaded by Neha Bhagirath on Saturday July 9, 2016. The Study Guide belongs to BE1500 at Wayne State University taught by Tonya Whitehead in Spring 2016. Since its upload, it has received 19 views. For similar materials see Intro to Programming in Engineering and Tech at Wayne State University.

×

## Reviews for Programming Exam Notes

×

×

### What is Karma?

#### You can buy or earn more Karma at anytime and redeem it for class notes, study guides, flashcards, and more!

Date Created: 07/09/16
EXAM REVIEW:    function[sum]=E2RP2(M)  r=1;  c=1;  sum=0;  [rows,cols]=size(M);  while r<=rows  %rows is the determined number of rows, r is the counter for the number of rows     while c<=cols    i mod(r,2)==1 %when you give a variable a value, it has one equal sign. when giving a condition it has two  equal signs      N(r,c)=M(r,c)^(1/3)  else      N(r,c)=M(r,c)^(1/2)  end  sum=sum+N(r,c) ​ %N is the new matrix, adding up all the values here   c=c+1;    ​ nd  end  r=r+1;%increment the other counter   c=1; %reset the c values or it will only take the last column value (have to reset the value for the inner loop  before you reset your outer loop in nested loops.)   %i reaches the max number of rows and has to go to the next line for the  %rows again, so you must reset it because the inner loop will stop  %otherwise   end    Command Window:  K>> E2RP2([2,3,4;3,4,5;3,4,5])    N =        1.2599      sum =        1.2599      N =        1.2599    1.4422      sum =        2.7022      N =        1.2599    1.4422    1.5874      sum =        4.2896    Answer to #3)  sum=0;  n=1; %define n above the while loop. could also use 0   while n<=1000      sum=(isprime(n)*n+sum); ​%we multiply by n because this is another option. isprime(n) will be  1 or 0, and if you have 1,      %you will multiply by n, the actual number, and add it on, instead of adding a 1 or a 0      n=n+1 ​n has to change in the loop   end     OR    sum=0;  forn=1:1000     i isprime(n)==1          sum=n+sum %​sum adds values     ​nd  end       Answer to #4)  functi [ max,min ] = Practice( M )  [rows,cols]=size(M);  max=M(1,1%setting the smallest and biggest number in our matrix as the max and min. Could do ­inf to +inf as well  min=M(1,1);  for r=1:rows     or​ c=1:cols        i max<M(r,c)              max=M(r,c)        end      i min>M(r,c)          min=M(r,c)  end   end

×

×

### BOOM! Enjoy Your Free Notes!

×

Looks like you've already subscribed to StudySoup, you won't need to purchase another subscription to get this material. To access this material simply click 'View Full Document'

## Why people love StudySoup

Bentley McCaw University of Florida

#### "I was shooting for a perfect 4.0 GPA this semester. Having StudySoup as a study aid was critical to helping me achieve my goal...and I nailed it!"

Amaris Trozzo George Washington University

#### "I made \$350 in just two days after posting my first study guide."

Bentley McCaw University of Florida

Forbes

#### "Their 'Elite Notetakers' are making over \$1,200/month in sales by creating high quality content that helps their classmates in a time of need."

Become an Elite Notetaker and start selling your notes online!
×

### Refund Policy

#### STUDYSOUP CANCELLATION POLICY

All subscriptions to StudySoup are paid in full at the time of subscribing. To change your credit card information or to cancel your subscription, go to "Edit Settings". All credit card information will be available there. If you should decide to cancel your subscription, it will continue to be valid until the next payment period, as all payments for the current period were made in advance. For special circumstances, please email support@studysoup.com

#### STUDYSOUP REFUND POLICY

StudySoup has more than 1 million course-specific study resources to help students study smarter. If you’re having trouble finding what you’re looking for, our customer support team can help you find what you need! Feel free to contact them here: support@studysoup.com

Recurring Subscriptions: If you have canceled your recurring subscription on the day of renewal and have not downloaded any documents, you may request a refund by submitting an email to support@studysoup.com