C programming windows console applicationSolution C code inc

C++ programming windows console application

Solution

// C++ code
#include <iostream>
#include <iomanip>
#include <math.h>

using namespace std;

double calcint( double loanamount, double intrate);

int main()
{
// declare variables
double loan = 0.0; // storage for loan amount
double rate = 0.0; // storage for interest rate
double total = 0.0; // storage for interest returned from function

// ask user for loan amount and interest rate
cout << \"Enter the amount of the loan: \";
cin >> loan;
cout << \"Enter interest rate: \";
cin >> rate;

// call the interest calculation function
total = calcint(loan,rate);

// print results
cout << \"Loan Amount = \" << loan << endl;
cout << \"Interest Rate = \" << rate << endl;
cout << \"Annual Interest = \" << total << endl;

return 0;
// end of main function
}

double calcint(double loanamount, double intrate)
{
double interest = 0.0;

interest = loanamount*intrate*1;

return interest;
// end function
}

/*
output:

Enter the amount of the loan: 2305
Enter interest rate: 9.1
Loan Amount = 2305
Interest Rate = 9.1
Annual Interest = 20975.5


*/

C++ programming windows console applicationSolution// C++ code #include <iostream> #include <iomanip> #include <math.h> using namespace std; d

Get Help Now

Submit a Take Down Notice

Tutor
Tutor: Dr Jack
Most rated tutor on our site