From 7f60ea012dd2524dae921a2a35adbf7ef21f2bb6 Mon Sep 17 00:00:00 2001 From: prashantsinalkar Date: Tue, 10 Oct 2017 12:27:19 +0530 Subject: initial commit / add all books --- 1553/CH7/EX7.1/7Ex1.sce | 22 ++++++++++++++++++++++ 1 file changed, 22 insertions(+) create mode 100644 1553/CH7/EX7.1/7Ex1.sce (limited to '1553/CH7/EX7.1/7Ex1.sce') diff --git a/1553/CH7/EX7.1/7Ex1.sce b/1553/CH7/EX7.1/7Ex1.sce new file mode 100644 index 000000000..321f1365d --- /dev/null +++ b/1553/CH7/EX7.1/7Ex1.sce @@ -0,0 +1,22 @@ +//Chapter 7 Ex1 + +clc; +clear; +close; +//let number be x +//given x-36=86-x +//thus polynomial is: 2x-122=0 + +mycoeff=[-122 2]; +p=poly(mycoeff,"x","coeff"); +ans=roots(p); +printf("The number is %d",ans); + + +//Alternative logic for same problem +for x=1:99 + if((2*x-122)==0) + printf("\nAlternate Logic: \nThe number is: %d",x); + break; +end +end -- cgit