diff options
Diffstat (limited to '662/CH8/EX8.13/Example8_13.sci')
-rwxr-xr-x | 662/CH8/EX8.13/Example8_13.sci | 21 |
1 files changed, 21 insertions, 0 deletions
diff --git a/662/CH8/EX8.13/Example8_13.sci b/662/CH8/EX8.13/Example8_13.sci new file mode 100755 index 000000000..fab4ae0b6 --- /dev/null +++ b/662/CH8/EX8.13/Example8_13.sci @@ -0,0 +1,21 @@ +//Programming Example 8.13
+//simple compound interest problem
+
+function[]=mainCI()
+ //read input data(including prompts)
+ printf("Please enter a value for the principle:(p)");
+ p=scanf("%f");
+ printf("Please Enter a value for the interest rate(r): ")
+ r=scanf("%f");
+ printf("Please Enter a value for the number of years(n): ")
+ n=scanf("%f");
+
+ //calculate i, then f
+ i= r/100;
+ f=p*(n^(1+i));
+ //display the output
+ printf("\n The final value(F) is: %.2f\n", f);
+endfunction
+
+//calling routine
+mainCI();
\ No newline at end of file |