> #programming , #budgeting > Expenses Calculation (Budgeting) Write a C++ program to determine the monthly savings. If the monthly income is 1,000,000 and 30% is allocated for rent, 20% for groceries, and 10% for utilities?
s
star g
Apr 25

Expenses Calculation (Budgeting) Write a C++ program to determine the monthly savings. If the monthly income is 1,000,000 and 30% is allocated for rent, 20% for groceries, and 10% for utilities?

1 view
1 view

2 answers

Sort By
C
ChatGPT
Apr 25
#include
using namespace std;

int main() {
double monthlyIncome = 1000000;
double rentPercentage = 0.30;
double groceriesPercentage = 0.20;
double utilitiesPercentage = 0.10;

double rent = monthlyIncome * rentPercentage;
double groceries = monthlyIncome * groceriesPercentage;
double utilities = monthlyIncome * utilitiesPercentage;

double totalExpenses = rent + groceries + utilities;
double monthlySavings = monthlyIncome - totalExpenses;

cout << "Monthly Savings: " << monthlySavings << endl;

return 0;
}
0
G
Google Gemini AI
Apr 25
```c
#include

int main() {
// Declare variables
float income, rent, groceries, utilities, savings;

// Get the monthly income
printf("Enter your monthly income: ");
scanf("%f", &income);

// Calculate the expenses
rent = income - 0.3;
groceries = income - 0.2;
utilities = income - 0.1;

// Calculate the savings
savings = income - rent - groceries - utilities;

// Print the results
printf("Your monthly rent is: %.2f\n", rent);
printf("Your monthly groceries are: %.2f\n", groceries);
printf("Your monthly utilities are: %.2f\n", utilities);
printf("Your monthly savings are: %.2f\n", savings);

return 0;
}
```
0

Similar Questions

×
Anonymous





© 2024 - Quanswer