diff options
Diffstat (limited to '659/CH5/EX5.1cs')
-rwxr-xr-x | 659/CH5/EX5.1cs/Casestudy1.sce | 31 | ||||
-rwxr-xr-x | 659/CH5/EX5.1cs/Casestudy1_output.PNG | bin | 0 -> 17508 bytes |
2 files changed, 31 insertions, 0 deletions
diff --git a/659/CH5/EX5.1cs/Casestudy1.sce b/659/CH5/EX5.1cs/Casestudy1.sce new file mode 100755 index 000000000..a9184f716 --- /dev/null +++ b/659/CH5/EX5.1cs/Casestudy1.sce @@ -0,0 +1,31 @@ +// Case Study:-Chapter 5, Page No:139
+// 1.Range of numbers
+
+sum1=0;
+count=0;
+f=0;value=1;
+printf("Enter numbers[press enter after each number]:\n input a NEGATIVE number to end\n");
+while(value)
+ [value]=scanf("%f"); //Read data
+ if(value<0) then
+ break;
+ end
+ count=count+1;
+ //Calculating height and lowest value
+ if(count==1) then
+ high=value;
+ low=value;
+ elseif(value>high) then
+ high=value;
+ elseif(value<low) then
+ low=value;
+ end
+ //Calculate sum
+ sum1=sum1+value;
+end
+average=sum1/count; //Average cost
+range1=high-low; //Range of values
+//Print the results
+printf("Total values: %d\n",count);
+printf("Highest-values: %f\nLowest-value: %f\n",high,low);
+printf("Range: %f\n Avarage: %f\n",range1,average);
diff --git a/659/CH5/EX5.1cs/Casestudy1_output.PNG b/659/CH5/EX5.1cs/Casestudy1_output.PNG Binary files differnew file mode 100755 index 000000000..9294e72ee --- /dev/null +++ b/659/CH5/EX5.1cs/Casestudy1_output.PNG |