diff options
author | priyanka | 2015-06-24 15:03:17 +0530 |
---|---|---|
committer | priyanka | 2015-06-24 15:03:17 +0530 |
commit | b1f5c3f8d6671b4331cef1dcebdf63b7a43a3a2b (patch) | |
tree | ab291cffc65280e58ac82470ba63fbcca7805165 /659/CH6/EX6.5 | |
download | Scilab-TBC-Uploads-b1f5c3f8d6671b4331cef1dcebdf63b7a43a3a2b.tar.gz Scilab-TBC-Uploads-b1f5c3f8d6671b4331cef1dcebdf63b7a43a3a2b.tar.bz2 Scilab-TBC-Uploads-b1f5c3f8d6671b4331cef1dcebdf63b7a43a3a2b.zip |
initial commit / add all books
Diffstat (limited to '659/CH6/EX6.5')
-rwxr-xr-x | 659/CH6/EX6.5/exm6_5.sce | 18 | ||||
-rwxr-xr-x | 659/CH6/EX6.5/exm6_5_output.PNG | bin | 0 -> 13157 bytes |
2 files changed, 18 insertions, 0 deletions
diff --git a/659/CH6/EX6.5/exm6_5.sce b/659/CH6/EX6.5/exm6_5.sce new file mode 100755 index 000000000..34071374e --- /dev/null +++ b/659/CH6/EX6.5/exm6_5.sce @@ -0,0 +1,18 @@ +// Example 6.5
+//Program illustrate use of the break statement
+
+disp("This program computes the avarage of set of numbers");
+disp("Enter values and enter a NEGATIVE value at the end");
+sum1=0;
+for m=1:1000
+ x=scanf("%f"); //Read data
+ if(x<0) then
+ break; //EXIT FROM LOOP
+ end
+ sum1=sum1+x; //Computes sum
+end
+average=sum1/(m-1); //Computes Average
+//Print the results
+printf("Number of values =%d\n",m-1);
+printf("sum1=%f\n",sum1);
+printf("Avarage =%f\n",average);
\ No newline at end of file diff --git a/659/CH6/EX6.5/exm6_5_output.PNG b/659/CH6/EX6.5/exm6_5_output.PNG Binary files differnew file mode 100755 index 000000000..178eeea75 --- /dev/null +++ b/659/CH6/EX6.5/exm6_5_output.PNG |