Advertisement
Kyojin96

Zadacha 3 Primer 1

Nov 24th, 2015
162
0
Never
Not a member of Pastebin yet? Sign Up, it unlocks many cool features!
C 0.75 KB | None | 0 0
  1. #include <stdio.h>
  2. #include <stdlib.h>
  3.  
  4. int main()
  5. {
  6.     int deposit, years;
  7.     float interest;
  8.  
  9.     int lihva = 0;
  10.     int newDeposit = 0;
  11.  
  12.     printf("Vuvedete deposit: "); scanf("%d", &deposit);
  13.     printf("Vuvedete lihva: "); scanf("%f", &interest);
  14.  
  15.     printf("Vuvedete godini: "); scanf("%d", &years);
  16.  
  17.     while(years > 5)
  18.     {
  19.         printf("Invalid.. Nova stoinost: "); scanf("%d", &years);
  20.     }
  21.  
  22.     //printf("Deposit: %d || Lihva: %f || Godini: %d\n", deposit, interest, years);
  23.  
  24.     int i = 0;
  25.     for(i; i < years; i++)
  26.     {
  27.         lihva += deposit * interest;
  28.     }
  29.  
  30.     newDeposit = lihva + deposit;
  31.  
  32.     printf("Deposit s lihva: %d\n", newDeposit);
  33.  
  34.     //{OPTIONAL}
  35.     system("pause");
  36.  
  37.     return 0;
  38. }
Advertisement
Add Comment
Please, Sign In to add comment
Advertisement