blob: dac2526403c672c8a889213a0b1f277034bcd0d2 (
plain)
1
2
3
4
5
6
7
8
9
10
11
12
13
14
15
|
//chapter 17 Ex6
clc;
clear;
close;
s1=25;s2=4; //given speeds in km/hr
function [s]=average(s1,s2)
s=(2*s1*s2)/(s1+s2);
endfunction
s=average(25,4);
t=5+(48/60); //converting minutes into hours
d=t*s; //distance=time*speed
dpost=d/2;
printf("The distance of post office from village is %2.0f km",dpost);
|