#include <math.h>
#include <stdio.h>

float calculate_volume(void) {
  float radius;
  printf("Hello from calculator\n");
  printf("Please, enter the radius of circle in meters: ");
  scanf("%f", &radius);
  float division = 4.0 / 3.0;
  float volume = division * M_PI * radius * radius * radius;
  return volume;
}

float tax_calculator(void) {
  float rubles, cents;
  printf("Please, enter the rubles amount: ");
  scanf("%f", &rubles);
  printf("Please, enter the cents amount: ");
  scanf("%f", &cents);
  float result = (rubles + (cents / 100)) * 1.05;
  return result;
}

void change_calculator(void) {
  int rubles;
  printf("Please, enter the rubles amount: ");
  scanf("%d", &rubles);
  /* In Russia, we have following bills:
   * 5000 rubles
   * 2000 rubles
   * 1000 rubles
   * 500 rubles
   * 200 rubles
   * 100 rubles
   * 50 rubles
   * 10 rubles
   * 1 ruble - we actually does not have 1 ruble bill, but for the sake of
   *  project we have
   */
  // Calculate for 5000
  int _5k_bills = rubles / 5000;
  // Remove this amount from total
  rubles = rubles - _5k_bills * 5000;
  // Calculate for 2000 for remeaning
  int _2k_bills = rubles / 2000;
  // Remove this amount from total
  rubles = rubles - _2k_bills * 2000;
  // Calculate for 1000 for remeaning
  int _1k_bills = rubles / 1000;
  // Remove this amount from total
  rubles = rubles - _1k_bills * 1000;
  // Calculate for 500 for remeaning
  int _500_bills = rubles / 500;
  // Remove this amount from total
  rubles = rubles - _500_bills * 500;
  // Calculate for 200 for remeaning
  int _200_bills = rubles / 200;
  // Remove this amount from total
  rubles = rubles - _200_bills * 200;
  // Calculate for 100 for remeaning
  int _100_bills = rubles / 100;
  // Remove this amount from total
  rubles = rubles - _100_bills * 100;
  // Calculate for 50 for remeaning
  int _50_bills = rubles / 50;
  // Remove this amount from total
  rubles = rubles - _50_bills * 50;
  // Calculate for 10 for remeaning
  int _10_bills = rubles / 10;
  // Remove this amount from total
  rubles = rubles - _10_bills * 10;
  // Print result
  printf("5000 bills\t%d\n", _5k_bills);
  printf("2000 bills\t%d\n", _2k_bills);
  printf("1000 bills\t%d\n", _1k_bills);
  printf("500 bills\t%d\n", _500_bills);
  printf("200 bills\t%d\n", _200_bills);
  printf("100 bills\t%d\n", _100_bills);
  printf("50 bills\t%d\n", _50_bills);
  printf("10 bills\t%d\n", _10_bills);
  printf("1 bills\t\t%d\n", rubles);
}

void load_calculator(void) {
  float loan, interest_rate, monthly_payment;
  loan = 20000.00;
  interest_rate = 6.0;
  monthly_payment = 386.66;
  float monthly_interest_rate = (interest_rate / 100) / 12;
  loan = loan + (loan * monthly_interest_rate) - monthly_payment;
  printf("LN\t%.2f\n", loan);
  loan = loan + (loan * monthly_interest_rate) - monthly_payment;
  printf("LN\t%.2f\n", loan);
  loan = loan + (loan * monthly_interest_rate) - monthly_payment;
  printf("LN\t%.2f\n", loan);
}

int main() {
  /* float volume = calculate_volume(); */
  /* printf("%f", volume); */

  /* float tax = tax_calculator(); */
  /* printf("%.2f", tax); */

  /* change_calculator(); */

  load_calculator();
}
