Tuesday, March 17, 2026

Write the program for the simple, compound interest || C Lab Program

WAP_A02:  Write the program for the simple, compound interest. || Simple Numeric Problems

Algorithm

start
step1: Read p, rate, time
step2: SI := (p * rate * time)/100
step3: CI := p * (1+(rate/100))time - p
step4: Print SI, CI
stop

WAP_A02: C Lab Program



/* calculate simple interest & compound interest by reading principal amount, rate of interest & time

The formula to find simple interest is simpleInterest = (principal * rate * time) / 100.

The formula to find compound interest is compoundInterest = principal * pow(1 + (rate / 100), time) - principal. */

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

int main() {
    float P, rate, time, SI, CI;

    // Input P amount, rate of interest and time
    printf("Enter P,R,T: ");
    scanf("%f%f%f", &P,&rate,&time);
   

    // Calculate simple interest
    SI = (P * rate * time) / 100;

    // Calculate compound interest
    CI = P * pow(1 + (rate / 100), time) - P;

    // Display results
    printf("SI= %f\n", SI);
    printf("CI= %f\n", CI);

    return 0;
}

OUTPUT

Enter P,R,T: 1000 5 10
SI= 500.000000
CI= 628.893860 

For all 2026 published articles list: click here

...till the next post, bye-bye & take care.

No comments:

Post a Comment