distance_whileloop - elseif (distance > 10)...

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

View Full Document Right Arrow Icon
% added 2/15/2011 in class % clear clc c flag = 1; while flag == 1 name = input('What is your name? ','s'); n = input ('What is the distance that needs to be covered in feet? '); distance = n/5280; miles = distance if distance <= 2 mode = 'Walk'; elseif (distance > 2) && (distance <= 10); mode = 'Bicycle';
Background image of page 1
This is the end of the preview. Sign up to access the rest of the document.

Unformatted text preview: elseif (distance &gt; 10) &amp;&amp; (distance &lt;= 30); mode = 'ride MARTA'; else distance &gt; 30; mode = 'take a plane on Delta Airlines'; end fprintf('%s, you have %.2f miles to go.\nYou should %s.\n'. .. , name, miles, mode) flag = input('Do you want to do it again 0(no) 1(yes)? '); end e...
View Full Document

This note was uploaded on 05/01/2011 for the course HCSC 110 taught by Professor Amosjohnson during the Spring '11 term at Morehouse.

Ask a homework question - tutors are online