blob: 321f1365d965fa2741aef8b010c5bce39368d3d8 (
plain)
1
2
3
4
5
6
7
8
9
10
11
12
13
14
15
16
17
18
19
20
21
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
|