summaryrefslogtreecommitdiff
path: root/659/CH6/EX6.2cs/Casestudy6_2.sce
diff options
context:
space:
mode:
Diffstat (limited to '659/CH6/EX6.2cs/Casestudy6_2.sce')
-rwxr-xr-x659/CH6/EX6.2cs/Casestudy6_2.sce30
1 files changed, 30 insertions, 0 deletions
diff --git a/659/CH6/EX6.2cs/Casestudy6_2.sce b/659/CH6/EX6.2cs/Casestudy6_2.sce
new file mode 100755
index 000000000..3cbb2eec8
--- /dev/null
+++ b/659/CH6/EX6.2cs/Casestudy6_2.sce
@@ -0,0 +1,30 @@
+// Case Study:-Chapter 6
+// 2.Histogram
+
+N=5;
+for n=1:N
+ printf("Enter employees in Group-%d:",n);
+ value(n)=scanf("%d"); //Read data in the array named value
+ printf("%d\n",value(n)); //Print number which is at position n
+end
+printf("\n");
+printf(" |\n");
+//Computation using for loop and draw a histogram
+for n=1:N
+ for i=1:3
+ if(i==2) then
+ printf("Group-%1d |",n);
+ else
+ printf(" |");
+ end
+ for j=1:value(n)
+ printf("*");
+ end
+ if(i==2)
+ printf("(%d)\n",value(n));
+ else
+ printf("\n");
+ end
+ end
+ printf(" |\n");
+end \ No newline at end of file