Untitled
unknown
plain_text
5 months ago
762 B
12
Indexable
#include <iostream> #include <iomanip> // For setting precision int main() { int currentPrice, lastMonthPrice; // Input current and last month's price std::cin >> currentPrice >> lastMonthPrice; // Calculate the change in price int priceChange = currentPrice - lastMonthPrice; // Calculate the estimated monthly mortgage double monthlyMortgage = (currentPrice * 0.051) / 12; // Output the required information std::cout << "This house is $" << currentPrice << ". The change is $"; std::cout << priceChange << " since last month." << std::endl; std::cout << "The estimated monthly mortgage is $" << std::fixed << std::setprecision(0) << monthlyMortgage << "." << std::endl; return 0;
Editor is loading...
Leave a Comment