Advertisement
Not a member of Pastebin yet?
Sign Up,
it unlocks many cool features!
- #include <stdio.h>
- int main()
- {
- int firstyear;
- int total1;
- int total2;
- float rate;
- float total3;
- float total4;
- float total5;
- printf("-------First Year\n");
- printf("Type '100000' for calculate 5 years deposit !\n\n");
- printf("A = ");//////////////////////////////////A
- scanf("%d", &firstyear);
- rate = firstyear*5.0/100.0;
- total1 = firstyear + rate;
- printf("Rate = %.f\n", rate);////RATE
- printf("Total = %d\n\n", total1);
- printf("-------Second year\n");
- printf("A =%d\n", total1);///////////////////////A
- rate = total1*5.0/100.0f;
- total2 = total1 + rate;
- printf("Rate =%.f\n", rate);/////RATE
- printf("Total = %d\n\n", total2);
- printf("-------Third year\n");
- printf("A =%d\n", total2);///////////////////////A
- rate = total2*5.0/100.0f;
- total3 = total2 + rate;
- printf("Rate =%.1f\n", rate);/////RATE
- printf("Total = %.1f\n\n", total3);
- printf("-------fourth year\n");
- printf("A =%.1f\n", total3);///////////////////////A
- rate = total3*5.0/100.0f;
- total4 = total3 + rate;
- printf("Rate =%.3f\n", rate);/////RATE
- printf("Total = %.3f\n\n", total4);
- printf("-------fifth year\n");
- printf("A =%.3f\n", total4);///////////////////////A
- rate = total4*5.0/100.0f;
- total5 = total4 + rate;
- printf("Rate =%.5f\n", rate);/////RATE
- printf("Total = %.5f\n\n", total5);
- printf("Ady's Overall Total Deposit is = %.5f\n\n", total5);
- return 0;
- }
Advertisement
Add Comment
Please, Sign In to add comment
Advertisement