diff options
author | priyanka | 2015-06-24 15:03:17 +0530 |
---|---|---|
committer | priyanka | 2015-06-24 15:03:17 +0530 |
commit | b1f5c3f8d6671b4331cef1dcebdf63b7a43a3a2b (patch) | |
tree | ab291cffc65280e58ac82470ba63fbcca7805165 /659/CH9/EX9.3 | |
download | Scilab-TBC-Uploads-b1f5c3f8d6671b4331cef1dcebdf63b7a43a3a2b.tar.gz Scilab-TBC-Uploads-b1f5c3f8d6671b4331cef1dcebdf63b7a43a3a2b.tar.bz2 Scilab-TBC-Uploads-b1f5c3f8d6671b4331cef1dcebdf63b7a43a3a2b.zip |
initial commit / add all books
Diffstat (limited to '659/CH9/EX9.3')
-rwxr-xr-x | 659/CH9/EX9.3/exm9_3.sci | 25 | ||||
-rwxr-xr-x | 659/CH9/EX9.3/exm9_3_output.PNG | bin | 0 -> 9423 bytes |
2 files changed, 25 insertions, 0 deletions
diff --git a/659/CH9/EX9.3/exm9_3.sci b/659/CH9/EX9.3/exm9_3.sci new file mode 100755 index 000000000..6665a2942 --- /dev/null +++ b/659/CH9/EX9.3/exm9_3.sci @@ -0,0 +1,25 @@ +// Example 9.3
+//Modify Example 9.2's function value() to return result and extend versatility of the function
+//printline by taking the lenth of line as an argument
+function []=printline(ch,len)
+ for i=1:len
+ printf("%c",ch);
+ end
+ printf("\n");
+endfunction
+function [amount]=value(p,r,n) //returns amount
+ sum1=p;
+ year=1;
+ while(year<=n)
+ sum1=sum1*(1+r);
+ year=year+1;
+ end
+ amount=sum1;
+endfunction
+printf("Enter principal amount,interest rate,and period\n[Enter in single line seperated by space]");
+[principal,inrate,period]=scanf("%f %f %d");
+//Calling functions
+printline('*',52);
+amount=value(principal,inrate,period);
+printf("%f\t%f\t%d\t%f\n",principal,inrate,period,amount);
+printline('=',52);
\ No newline at end of file diff --git a/659/CH9/EX9.3/exm9_3_output.PNG b/659/CH9/EX9.3/exm9_3_output.PNG Binary files differnew file mode 100755 index 000000000..2cae54f8c --- /dev/null +++ b/659/CH9/EX9.3/exm9_3_output.PNG |