I started my cs50 course this week and I will be trying to make little projects alongside to reaffirm what I've learned thus far. Here I have made a very basic budget and savings calculator, I am hoping to increase the complexity as I improve.
Where could I improve this in terms of simplicity & structure/slickness? Also are there ways I can make this more complex and add things into it? thanks!
#include <cs50.h>
#include <stdio.h>
int main(void)
// Prompt for Monthly Income
{
int Monthly_Income;
{
Monthly_Income = get_int("Please enter your monthly income");
}
// Prompt for total Expenditure
int Expenditure;
{
Expenditure = get_int("Please enter your monthly expenditure");
}
int Income_Remaining = (Monthly_Income - Expenditure);
printf("Income remaining %i\n", Income_Remaining);
// Prompt for savings per month
int S;
{
S = get_int("Enter your target savings contribution per month");
}
// Calculate total Discretionary income
int Discretionary_income = (Income_Remaining - S);
printf("Discretionary income %i\n", Discretionary_income);
// Calculate Savings total per month
int i = 0;
int Total = 0;
do
{
Total = Total + S;
i++;
printf("your total savings are %i\n", Total);
printf("total months %i\n", i);
}
while (i < 24);
}