Knowee
Questions
Features
Study Tools

Write a C program to compute:§ (a) Simple Interest, S.I = Principal*Rate*Time/100§ (b) Compound Interest C.I = P(1+(r/n))nt25

Question

Write a C program to compute:

§ (a) Simple Interest, S.I = Principal * Rate * Time / 100

§ (b) Compound Interest C.I = P(1 + (r/n))^(nt)

🧐 Not the exact question you are looking for?Go ask a question

Solution

Sure, here is a simple C program to calculate both Simple Interest and Compound Interest:

#include<stdio.h>
#include<math.h>

int main() {
    float principal, rate, time, simple_interest, compound_interest;
    int n;

    printf("Enter the principal amount: ");
    scanf("%f", &principal);

    printf("Enter the rate of interest: ");
    scanf("%f", &rate);

    printf("Enter the time in years: ");
    scanf("%f", &time);

    printf("Enter the number of times interest applied per time period: ");
    scanf("%d", &n);

    // calculate simple interest
    simple_interest = (principal * rate * time) / 100;
    printf("Simple Interest = %.2f\n", simple_interest);

    // calculate compound interest
    compound_interest = principal * (pow((1 + rate / (n*100)), n*time));
    printf("Compound Interest = %.2f\n", compound_interest);

    return 0;
}

This program first takes the principal amount, rate of interest, time in years, and the number of times interest is applied per time period as input from the user. It then calculates the simple interest using the formula S.I = Principal*Rate*Time/100 and the compound interest using the formula C.I = P(1+(r/n))nt. The calculated simple interest and compound interest are then printed to the console.

This problem has been solved

Similar Questions

Use the formula for continuously compounded interest, A = Pert, to find the annual interest rate for an $8000 investment that earns $410.17 in one year.

Which of the following formulas correctly represents the calculation for compound interest?*I = (P×r×t)/100I=P×r×tA=P(1+r)^tI=P×(1+rt)

Find the rate, if simple interest earned is Rs. 168 on a principal of Rs.1050 for 2 years.

Calculate the simple interest earned. Round to the nearest cent.P = $2300, r = 5.3%, t = 6 months

The rate is given as a percent (%). Before using it in the simple interest formula, you must first convert it to a

1/3

Upgrade your grade with Knowee

Get personalized homework help. Review tough concepts in more detail, or go deeper into your topic by exploring other relevant questions.