C++ program to calculate interest


Following program shows you how to calculate interest.
In this program we get investment, interest rate and time from user and calculate interest using following formula
Interest = investment X interestRate X time / 100

#include <iostream>

int main() {
	int investment;
	int interestRate;
	int time;

	std::cout << "Enter investment:";
	std::cin >> investment;

	std::cout << "Enter interest rate:";
	std::cin >> interestRate;

	std::cout << "Enter number of years:";
	std::cin >> time;

	int interest = investment * interestRate * time / 100;

	std::cout << "Interest amount is: " << interest;
}

Output:

Enter investment: 200000
Enter interest rate: 24
Enter number of years: 2
Interest amount is: 96000