Saturday, June 6, 2009

Monthly Expenses program in C

Monthly Expenses program in C (Source Code)

Here is a simple program to prepare your monthly budget. For simplicity, I suggest to have the following income

  • Salary
  • Rent received
  • Others (may include any other sources of income)
We will have the following recurring expenses

  • House Rent
  • Electricity (PUB)
  • Telephone
  • Education-Kids
  • Education-Self
  • Medical
  • Insurance

Now the problem is to find the surplus/deficit for the particular month is given below:

#include <>
#include <>
void main()
{
float nSalary, nRentRec, nOtherIn;
float nRentPaid, nPUB, nTele, nEdKid, nEdSelf, nMed, nInsur;
float nInTotal, nExTotal, nBalance;
clrscr();
cout<<"Monthly Expenses Vs Income\n";
cout<<"--------------------------\n";
cout<<"INCOME\n";
cout<<"======\n";
cout<<"Salary :";cin>>nSalary;
cout<<"Rent Received :";cin>>nRentRec;
cout<<"Other Income :";cin>>nOtherIn;
cout<<"EXPENSES\n";
cout<<"========\n";
cout<<"Rent Paid :";cin>>nRentPaid;
cout<<"Public Utility :";cin>>nPUB;
cout<<"Telephone :";cin>>nTele;
cout<<"Education-Kids :";cin>>nEdKid;
cout<<"Education-Self :";cin>>nEdSelf;
cout<<"Medical :";cin>>nMed;
cout<<"Insurance :";cin>>nInsur;
nInTotal = nSalary + nRentRec + nOtherIn;
nExTotal = nRentPaid + nPUB + nTele
+ nEdKid + nEdSelf + nMed + nInsur;
nBalance = nInTotal - nExTotal;
cout<<"\nTotal Income : "<<><<"\nTotal Expenses : "<<>
if (nBalance<0)
cout<<"\nDeficit : ";
else
cout<<"\nSurplus : ";
cout<<>

getch();
}

No comments:

Post a Comment