diff options
Diffstat (limited to '659/CH5/EX5.6/exm5_6.sce')
-rwxr-xr-x | 659/CH5/EX5.6/exm5_6.sce | 21 |
1 files changed, 21 insertions, 0 deletions
diff --git a/659/CH5/EX5.6/exm5_6.sce b/659/CH5/EX5.6/exm5_6.sce new file mode 100755 index 000000000..42e10995c --- /dev/null +++ b/659/CH5/EX5.6/exm5_6.sce @@ -0,0 +1,21 @@ +// Example 5.6
+// A program to process loan applications and to sanction loans.
+
+MAXLOAN=50000;
+disp("Enter the values of previous two loans");
+loan1=int32(input("Enter first loan:"));
+loan2=int32(input("Enter second loan:"));
+loan3=int32(input("Enter the values of new loan:"));
+sum23=loan2+loan3;
+//Calculate the sanction loan
+if(loan1>0),
+ sancloan=0;
+ elseif(sum23>MAXLOAN),
+ sancloan=MAXLOAN-loan2;
+ else
+ sancloan=loan3;
+end
+//Print the results
+printf("Previous loans pending:%d %d\n",loan1,loan2);
+printf("Loan requested =%d\n",loan3);
+printf("Loan sanctioned =%d\n",sancloan);
|