Okay so this is what I got now,
Code:
#include "stdio.h"
double calBalance(int wsalary, int wfuel, double wtoll, int wfood);
int main()
{
int salary = 0;
int fuel = 0;
double toll = 0;
int food = 0;
double balance = 0.00;
int workDays = 0;
puts("My console in C to calculate my budget. Every component except salary takes DAILY use.\n");
printf("Working Days: ");
scanf("%d", &workDays);
printf("Salary: ");
scanf("%d", &salary);
printf("Fuel: ");
scanf("%d", &fuel);
fuel = fuel * workDays;
printf("Toll: ");
scanf("%lf", &toll);
toll = toll * workDays;
printf("Food: ");
scanf("%d", &food);
food = food * workDays;
balance = calBalance(salary, fuel, toll, food);
printf("\nBalance: %.2f", balance);
puts("");
return 0;
}
double calBalance(int wsalary, int wfuel, double wtoll, int wfood)
{
double wBalance = 0.00;
wBalance = wsalary - (wfuel + wtoll + wfood);
return wBalance;
}
Is it even appropriate practice to put as much parameters in a function? Well, for now I have 4, but I might have around 5~6 more.