summaryrefslogtreecommitdiff
path: root/1553/CH8/EX8.3/8Ex3.sce
blob: c133469ab1724f44716fc5e06c7318ee9b3e3654 (plain)
1
2
3
4
5
6
7
8
9
10
11
12
13
14
//chapter 8 Ex 3

clc;
clear;
close;
//let ankita's age be x, thus nikita'a age=240/x
//by the given condition: 2*240/x-x=4; equation is: x^2+4*x-480;
mycoeff=[-480 4 1];
p=poly(mycoeff,"x","coeff");
ageAnkita=roots(p);
ageNikita=240/ageAnkita(2);//since age cannot be negative
printf("Age of Nikita is %d years",ageNikita);