Advertisement
Hugo_souhoka

deposit

Sep 25th, 2020
1,263
0
Never
Not a member of Pastebin yet? Sign Up, it unlocks many cool features!
C++ 1.61 KB | None | 0 0
  1. #include <stdio.h>
  2.  
  3. int main()
  4. {
  5.     int firstyear;
  6.     int total1;
  7.     int total2;
  8.    
  9.     float rate;
  10.     float total3;
  11.     float total4;
  12.     float total5;
  13.    
  14.                             printf("-------First Year\n");
  15.                             printf("Type '100000' for calculate 5 years deposit !\n\n");
  16.  
  17.                             printf("A = ");//////////////////////////////////A
  18.                             scanf("%d", &firstyear);
  19.    
  20.     rate = firstyear*5.0/100.0;
  21.     total1 = firstyear + rate;
  22.    
  23.                             printf("Rate = %.f\n", rate);////RATE
  24.                             printf("Total = %d\n\n", total1);
  25.  
  26.                             printf("-------Second year\n");
  27.                             printf("A =%d\n", total1);///////////////////////A
  28.    
  29.     rate = total1*5.0/100.0f;
  30.     total2 = total1 + rate;
  31.    
  32.                             printf("Rate =%.f\n", rate);/////RATE
  33.                             printf("Total = %d\n\n", total2);
  34.                            
  35.                             printf("-------Third year\n");
  36.                             printf("A =%d\n", total2);///////////////////////A
  37.    
  38.     rate = total2*5.0/100.0f;
  39.     total3 = total2 + rate;
  40.    
  41.                             printf("Rate =%.1f\n", rate);/////RATE
  42.                             printf("Total = %.1f\n\n", total3);
  43.                            
  44.                             printf("-------fourth year\n");
  45.                             printf("A =%.1f\n", total3);///////////////////////A                       
  46.  
  47.     rate = total3*5.0/100.0f;
  48.     total4 = total3 + rate;
  49.                             printf("Rate =%.3f\n", rate);/////RATE
  50.                             printf("Total = %.3f\n\n", total4);
  51.                            
  52.                             printf("-------fifth year\n");
  53.                             printf("A =%.3f\n", total4);///////////////////////A
  54.                        
  55.     rate = total4*5.0/100.0f;
  56.     total5 = total4 + rate;    
  57.                             printf("Rate =%.5f\n", rate);/////RATE
  58.                             printf("Total = %.5f\n\n", total5);
  59.                            
  60.   printf("Ady's Overall Total Deposit is  = %.5f\n\n", total5);
  61.     return 0;                                              
  62. }
  63.  
Advertisement
Add Comment
Please, Sign In to add comment
Advertisement