A machine purchased for RM28,000 is depreciated at a rate of RM4,000 a year for 7 years.
Write and run a C++ program that computes and displays a depreciation table for 7 years.
#include <iostream>
using namespace std;
int main()
{
int cost = 28000;
cout << "Purchased cost: RM" << cost << endl << endl;
cout << "Depreciation table:" << endl;
int depr_rate = 4000;
for (int i = 1; i <= 7; i++) {
cout << "Year " << i << ": cost = RM" << cost - depr_rate * i << endl;
}
}
Comments
Leave a comment