Q26 If Loan amount, Number of months and Rate of interest are entered through the keyboard, write a program to calculate the monthly installment (including contribution towards Principle and Interest) for each month of loan duration.

If Loan amount, Number of months and Rate of interest are entered through the keyboard write a program to calculate the monthly installment (including contribution towards Principle and Interest) for each month of loan duration.

Program: 119

If Loan amount, Number of months and Rate of interest are entered through the keyboard write a c program to calculate the monthly installment (including contribution towards Principle and Interest) for each month of loan duration.

#include<stdio.h>
#include<conio.h>
#include<math.h>
int main()
{
    int i;
    float p, n, r;
    float emi, m_r,r_p,i_p,b_p,t_i=0;

    p = 10000; //loan amount
    n = 5;  //months
    r = 10; //Rate of interest per year (10%);

    //calculate rate of interest monthly
    m_r = (r/12)/100;

    emi = p * (m_r*pow((1+m_r),n)/(pow((1+m_r),n)-1));

    //for principal and interest contribution

    //remaining pay (r_p)

    r_p = p;

    //column names
    printf("Month:  Basic Pay\tInterest Pay\tEMI\t\tRemaining Pay\n");

    for(i=1;i<=n;i++)
    {
        //interest pay (i_p)
        i_p = r_p * m_r;

        //basic pay (b_p) without interest
        b_p = emi - i_p;

        r_p = r_p - b_p;

        t_i = t_i+i_p;
        //print the result

        printf("%d: \t%.2f\t \t%.2f\t \t%.2f\t\t %.2f\n", i, b_p, i_p, emi, r_p);
    }
printf("Total Interest Paid: %.2f",t_i);
    //printf("%f",emi);
}

Output:

Month: Basic Pay  Interest Pay   EMI       Remaining Pay
1:     1966.94    83.33          2050.28   8033.06
2:     1983.33    66.94          2050.28   6049.72
3:     1999.86    50.41          2050.28   4049.86
4:     2016.53    33.75          2050.28   2033.33
5:     2033.33    16.94          2050.28   -0.00
Total Interest Paid: 251.38

Lokesh Kumar: Being EASTER SCIENCE's founder, Lokesh Kumar wants to share his knowledge and ideas. His motive is "We assist you to choose the best", He believes in different thinking.
Related Post
Leave a Comment

This website uses cookies.