summaryrefslogtreecommitdiff
path: root/659/CH6/EX6.3cs/Casestudy6_3.sce
diff options
context:
space:
mode:
Diffstat (limited to '659/CH6/EX6.3cs/Casestudy6_3.sce')
-rwxr-xr-x659/CH6/EX6.3cs/Casestudy6_3.sce20
1 files changed, 20 insertions, 0 deletions
diff --git a/659/CH6/EX6.3cs/Casestudy6_3.sce b/659/CH6/EX6.3cs/Casestudy6_3.sce
new file mode 100755
index 000000000..58db705a6
--- /dev/null
+++ b/659/CH6/EX6.3cs/Casestudy6_3.sce
@@ -0,0 +1,20 @@
+// Case Study:-Chapter 6
+// 3.Minimum Cost
+
+for p=0:0.1:10
+ cost=48-8*p+p^2;
+ if(p==0) ,
+ cost1=cost;
+ continue; //Use of continue statement
+ end
+
+ if(cost>=cost1) ,
+ break; //Use of break statement
+ end
+ cost1=cost;
+ p1=p;
+end
+p =(p+p1)/2.0;
+cost=40-8*p+p^2; //Computes the cost
+//print the result
+printf("MINIMUM COST=%.2f AT p=%.1f\n",cost,p); \ No newline at end of file