diff options
Diffstat (limited to '659/CH3/EX3.5/exm3_5.sce')
-rwxr-xr-x | 659/CH3/EX3.5/exm3_5.sce | 13 |
1 files changed, 13 insertions, 0 deletions
diff --git a/659/CH3/EX3.5/exm3_5.sce b/659/CH3/EX3.5/exm3_5.sce new file mode 100755 index 000000000..93136c7b1 --- /dev/null +++ b/659/CH3/EX3.5/exm3_5.sce @@ -0,0 +1,13 @@ +// Example 3.5
+//Output of program shows round-off errors that can occur in computation of floating point numbers
+
+//Sum of n terms of 1/n
+count=1;
+sum1=0;
+n=input("Enter value of n:");
+term=1.0/n;
+while(count<=n)
+ sum1=sum1+term;
+ count=count+1;
+end
+printf("Sum= %f",sum1);
\ No newline at end of file |