Breaking

Monday, February 18, 2019

#3: C Program To find out the Simple Interest Given Principal, Rate & Time

                Simple Interest.

Source Code:
/**
 * C program to calculate simple interest
 */
#include <stdio.h>
int main()
{
    float principle, time, rate, SI;

    /* Input principle, rate and time */
    printf("Enter principle (amount):\n ");
    scanf("%f", &principle);

    printf("Enter time:\n");
    scanf("%f", &time);

    printf("Enter rate:\n");
    scanf("%f", &rate);

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

    /* Print the resultant value of SI */
    printf("Simple Interest = %f", SI);
    return 0;

}

 Output Console:







Logic:
Step by step descriptive logic to calculate simple interest.
  1. Input principle amount in some variable say principle.
  2. Input time in some variable say time.
  3. Input rate in some variable say rate.
  4. Find simple interest using formula SI = (principle * time * rate) / 100.
  5. Finally, print the resultant value of SI.

No comments:

Post a Comment

Popular Posts

Post Top Ad

Your Ad Spot

Pages