im trying to use the power function pow() but when I do the program fails to compile
with undefind refer to pow
Code:// calculate loan payments on a mortgage #include <stdio.h> #include <math.h> int main() { // declare all variables double principal_amount = 0; double interest_rate = 0; int years = 0; system ("clear"); printf ( " This program will calculate your monthly payment of a Home Mortgage\n\n"); printf ( " First it will need some info \n\n" ); scanf ( " Please enter the loan amount:\t %d \n\n", &principal_amount ); scanf ( " Next how many years would you like the loan for?\t %d \n\n", &years ); scanf ( " And last what intrest rate are you getting?\t %d \n\n", &interest_rate ); int number_of_payments = years * 12; double monthly_interest = interest_rate / 12; double x = pow( 1.0 + monthly_interest, number_of_payments ); double monthly_payment = ( principal_amount * x * monthly_interest ) / ( x - 1 ); printf ( "\n\n Your monthly payment would be %d.2\n\n ", monthly_payment ); return 0; }



LinkBack URL
About LinkBacks



