What is missing from this c program. please help me.... thanks?

View your credit file based on any of the UK credit reference agencies, or all three at once
LifeLock is the only Identity Theft Prevention Solution backed by a one-million dollar guarantee!Click here to get a 10% discount.



LifeLock Identity Theft Prevention - Save 10%

The simple interest on a loan is calculated by the formula

interest = principal * rate * days / 365;

The preceding formula assumes that rate is the annual interest rate, and therefore includes the division by 365 (days). Develop a program that will input principal, rate and days for several loans, and will calculate and display the simple interest for each loan, using the preceding formula.

#include<iostream.h>

#include <stdio.h>

int main(void)

{

int principal, rate, days, interest;

printf("enter principal\n");

scanf("%d", &principal);

printf(" enter rate\n");

scanf("%d", &rate);

printf(" enter days ");

scanf("%d", days);

interest = principal * rate * days / 365;

printf(" the interest is %d");

system("pause");

return 0;

}

What is missing from this c program. please help me.... thanks?

No & in front of days in scanf

interest should probably not be integer in real life because of div by 365.

What is missing from this c program. please help me.... thanks?

The corrected version.

#include <stdio.h>

int main(void)

{

double principal, rate, interest;

int days;

printf("enter principal $");

scanf("%lf", &principal);

printf(" enter rate :");

scanf("%lf", &rate);

printf(" enter days ");

scanf("%d", &days);

interest = principal * rate * days / 365.0;

printf(" the interest is %f", interest);

printf("Press Enter>");

fflush(stdin);

getchar();

return 0;

}



More Related Questions and Answers ...
  • Question about Credit Rating?
  • I need quick financial help, but don&#039..
  • There are so many mortgage lenders, how do I ..
  • APR on my HELOC does not calculate as I think..
  • Credit Rating?
  • Lending Tree, can it really be that cheap to ..
  • Bankrate.com?
  • Is there a site similar to Lendingtree.com fo..
  • Paying back some loans?
  • What is the average bill consolidation rate.?
  • Is there any benefit to not consolidating stu..
  • My credit rating is awful.?
  • When the Fed runs out of rate cuts........?
  • Who provides the best used manufactured home ..
  • Help on Student Loans for College!?
  • What&#039;s the best way to use my money...
  • Is 6.375% a good interest rate on a 30-year f..
  • Need info on loans, house is paid off but cre..
  • Loans or credit cards for people with NO CRED..

  • The loan information post by website user , we not guarantee correctness.