diff options
Diffstat (limited to '1553/CH7/EX7.9/7Ex9.sce')
-rw-r--r-- | 1553/CH7/EX7.9/7Ex9.sce | 16 |
1 files changed, 16 insertions, 0 deletions
diff --git a/1553/CH7/EX7.9/7Ex9.sce b/1553/CH7/EX7.9/7Ex9.sce new file mode 100644 index 000000000..6ef55c787 --- /dev/null +++ b/1553/CH7/EX7.9/7Ex9.sce @@ -0,0 +1,16 @@ +//Chapter 7 Ex 9
+
+clc;
+close;
+
+//let first number be x,thus other numbers are x+2 and x+4;
+//given is x^2+(x+2)^2+(x+4)^2=2531; after solving equation is x^2+4*x-837
+ mycoeff=[-837 4 1];
+p=poly(mycoeff,"x","coeff");
+r=roots(p);
+r1=r(1)+2;
+r2=r(1)+4;
+printf("The numbers are either %d, %d, %d OR",r(1),r1,r2);
+r3=r(2)+2;
+r4=r(2)+4;
+printf(" %d, %d, %d",r(2),r3,r4);
|