Welcome to collectivesolver - Programming & Software Q&A with code examples. A website with trusted programming answers. All programs are tested and work.

Contact: aviboots(AT)netvision.net.il

Prodentim Probiotics Specially Designed For The Health Of Your Teeth And Gums

Instant Grammar Checker - Correct all grammar errors and enhance your writing

Teach Your Child To Read

Powerful WordPress hosting for WordPress professionals

Disclosure: My content contains affiliate links.

31,038 questions

40,794 answers

573 users

How to calculate monthly EMI for a loan in C++

1 Answer

0 votes
#include <iostream>
#include <cmath> 

using std::cout;

int main()
{
	float loan_amount = 100000, interest_per_month = 10.5, years = 6;

	interest_per_month = interest_per_month / (12 * 100);

	int total_months = years * 12;

	float emi = (loan_amount * interest_per_month *
		         pow(1 + interest_per_month, total_months)) /
		        (pow(1 + interest_per_month, total_months) - 1);

	cout << "Monthly EMI = " << emi << "\n";

	return 0;
}


/*
run:

Monthly EMI = 1877.9

*/

 





answered Jul 18, 2018 by avibootz

Related questions

1 answer 76 views
1 answer 162 views
1 answer 11 views
1 answer 14 views
...