In: Computer Science
1. Write a program that analyzes savings and expenses (variables of type double). Prompt the user for and retrieve these two values that have been given values. The program outputs the word Solvent, decreases the value of savings by the value of expenses, and sets the value of expenses to zero if the savings is at least as large as expenses. If, however, savings is less than expenses, the program simply outputs the word Bankrupt and does not change the value of any variables. pls write code in c++
#include <iostream> using namespace std; int main() { double savings, expenses; cout << "Enter savings: "; cin >> savings; cout << "Enter expenses: "; cin >> expenses; if(expenses <= savings) { savings -= expenses; cout << "Solvent" << endl; } else { cout << "Bankrupt" << endl; } }
************************************************** Thanks for your question. We try our best to help you with detailed answers, But in any case, if you need any modification or have a query/issue with respect to above answer, Please ask that in the comment section. We will surely try to address your query ASAP and resolve the issue.
Please consider providing a thumbs up to this question if it helps you. by Doing that, You will help other students, who are facing similar issue.