summaryrefslogtreecommitdiff
path: root/659/CH2/EX2.4/exm2_4.sce
diff options
context:
space:
mode:
Diffstat (limited to '659/CH2/EX2.4/exm2_4.sce')
-rwxr-xr-x659/CH2/EX2.4/exm2_4.sce13
1 files changed, 13 insertions, 0 deletions
diff --git a/659/CH2/EX2.4/exm2_4.sce b/659/CH2/EX2.4/exm2_4.sce
new file mode 100755
index 000000000..3830f8d2c
--- /dev/null
+++ b/659/CH2/EX2.4/exm2_4.sce
@@ -0,0 +1,13 @@
+// Example 2.4
+// Sample program 3(exm1.5) discussed in chapter 1 can be convered in to a more flexible intractive program using scanf() function
+disp("Enter in single line separted by space");
+disp("Input amount,interest rate, and period");
+[amount,inrate,period]=scanf("%f %f %d"); //use of scanf()
+year=1;
+//Computation using while loop
+while(year<=period)
+ value=amount+inrate*amount;
+ printf("%2d Rs %8.2f\n",year,value)
+ year=year+1;
+ amount=value;
+end