From b1f5c3f8d6671b4331cef1dcebdf63b7a43a3a2b Mon Sep 17 00:00:00 2001 From: priyanka Date: Wed, 24 Jun 2015 15:03:17 +0530 Subject: initial commit / add all books --- 659/CH6/EX6.6/exm6_6.sce | 24 ++++++++++++++++++++++++ 659/CH6/EX6.6/exm6_6_output.PNG | Bin 0 -> 17913 bytes 2 files changed, 24 insertions(+) create mode 100755 659/CH6/EX6.6/exm6_6.sce create mode 100755 659/CH6/EX6.6/exm6_6_output.PNG (limited to '659/CH6/EX6.6') diff --git a/659/CH6/EX6.6/exm6_6.sce b/659/CH6/EX6.6/exm6_6.sce new file mode 100755 index 000000000..fb682a654 --- /dev/null +++ b/659/CH6/EX6.6/exm6_6.sce @@ -0,0 +1,24 @@ +// Example 6.6 +//Program to evaluate the series i.e. +// 1/1-x = 1+x+x^2+x^3+.....+x^n + +x=input("Input value of x:"); //Read value of x +LOOP=100; ACCURACY=0.0001; //Initialization +sum1=0;term=1;flag=0; +//Computation using for loop +for n=1:LOOP + sum1=sum1+term; + if(term<=ACCURACY) then //Test for accuracy + flag=1; + break; + end + term=term*x; + +end +//Print the results +if(flag==1) then + printf(" EXIT FROM LOOP\n"); + printf(" Sum =%f ; No. of terms =%d",sum1,n); +else + disp("FINAL VALUE OF N IS NOT SUFFICIENT TO ACHIEVE DESIRED ACCURCY"); +end \ No newline at end of file diff --git a/659/CH6/EX6.6/exm6_6_output.PNG b/659/CH6/EX6.6/exm6_6_output.PNG new file mode 100755 index 000000000..66b048db0 Binary files /dev/null and b/659/CH6/EX6.6/exm6_6_output.PNG differ -- cgit