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.5/exm6_5.sce | 18 ++++++++++++++++++ 659/CH6/EX6.5/exm6_5_output.PNG | Bin 0 -> 13157 bytes 2 files changed, 18 insertions(+) create mode 100755 659/CH6/EX6.5/exm6_5.sce create mode 100755 659/CH6/EX6.5/exm6_5_output.PNG (limited to '659/CH6/EX6.5') 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 new file mode 100755 index 000000000..178eeea75 Binary files /dev/null and b/659/CH6/EX6.5/exm6_5_output.PNG differ -- cgit