Advertisement
Guest User

Untitled

a guest
Oct 21st, 2019
131
0
Never
Not a member of Pastebin yet? Sign Up, it unlocks many cool features!
text 1.33 KB | None | 0 0
  1.  
  2. #include <stdio.h>
  3. void options();
  4. void testInterest();
  5. double simpleInterest(double pAmmount,double aInterest,int years);
  6. double compoundInterest(double pAmmount,double aInterest,int yeard);
  7.  
  8. int main()
  9. {
  10. options();
  11.  
  12. }
  13. void testInterest()
  14. {
  15.  
  16. }
  17.  
  18. void options()
  19. {
  20. int options;
  21. int year;
  22. int annualIn;
  23. int pammount;
  24. printf("Simple Interest Calulcator - 1 \n");
  25. printf("Compound Interest Calculator - 2 \n");
  26. printf ("Choose option \n");
  27. scanf ("%d",&options);
  28. printf ("Enter the Principle ammount ");
  29. scanf ("%d",&pammount);
  30. printf("Enter the annula Interest");
  31. scanf ("%d",&annualIn);
  32. printf("Enter the number of years");
  33. scanf ("%d",&year);
  34. if (options == 1)
  35. {
  36. int s1;
  37.  
  38. s1=simpleInterest(pammount,annualIn,year);
  39. printf ("%d",s1);
  40.  
  41. }
  42. else
  43. {
  44. int s1;
  45.  
  46. s1=compoundInterest(pammount,annualIn,year);
  47. printf ("%d",s1);
  48.  
  49. }
  50.  
  51. }
  52. double simpleInterest(double pAmmount,double aInterest,int years)
  53. {
  54. int Bammount;
  55.  
  56. Bammount=pAmmount*(1+aInterest*years);
  57. return Bammount;
  58. }
  59. double compoundInterest(double pAmmount,double aInterest,int yeard)
  60. {
  61.  
  62. int Bammount;
  63. Bammount=pAmmount*((1+aInterest)*(1+aInterest));
  64. return Bammount;
  65. }
Advertisement
Add Comment
Please, Sign In to add comment
Advertisement