summaryrefslogtreecommitdiff
path: root/662/CH4/EX4.32
diff options
context:
space:
mode:
Diffstat (limited to '662/CH4/EX4.32')
-rwxr-xr-x662/CH4/EX4.32/ex4_32.JPGbin0 -> 30645 bytes
-rwxr-xr-x662/CH4/EX4.32/ex4_32.sce23
2 files changed, 23 insertions, 0 deletions
diff --git a/662/CH4/EX4.32/ex4_32.JPG b/662/CH4/EX4.32/ex4_32.JPG
new file mode 100755
index 000000000..80a9fb1e2
--- /dev/null
+++ b/662/CH4/EX4.32/ex4_32.JPG
Binary files differ
diff --git a/662/CH4/EX4.32/ex4_32.sce b/662/CH4/EX4.32/ex4_32.sce
new file mode 100755
index 000000000..714ef1a8d
--- /dev/null
+++ b/662/CH4/EX4.32/ex4_32.sce
@@ -0,0 +1,23 @@
+ //Example 4.32
+ //Averaging student exam scores
+
+//sample intractive program
+printf("Please Enter your name: "); // enter name
+name=input("Enter your name: ", "string");
+
+printf("Please enter the first score: "); // enter 1st score
+score1=scanf("%f");
+
+printf("Please enter the second score: "); // enter 2nd score
+score2=scanf("%f");
+
+printf("Please enter the third score: "); // enter 3rd score
+score3=scanf("%f");
+
+avg=(score1+score2+score3)/3; // calculate average
+
+printf("\n\nName: %-s\n\n", name); // write output
+printf("score 1: %-5.1f\n",score1);
+printf("score 2: %-5.1f\n",score2);
+printf("score 3: %-5.1f\n\n",score3);
+printf("Average: %-5.1f\n\n",avg);