Sunday, February 14, 2016

C Program to calculate the Simple Interest

/*==========================================================================================
**
**  File Name     : simpleInterest.c
**  Creation Date : Mon 15 Feb 2016 03:04:48 AM IST
**  Last Modified : Mon 15 Feb 2016 03:26:28 AM IST
**  Compoler      : gcc
**  Author        : Manoj Kumar Patra, manojpatra.in@gmail.com
**  Organization  : SCIS, University of Hyderabad, India.
**
**=========================================================================================*/

#include<stdio.h>
int main()
{
    float pa, rt, si, total;
    int t;
    printf("\n= = = = = = = = =  = Simple Interest Calculation = = = = = = = = = =");
    printf("\nEnter the principal amount: ");
    scanf("%f",&pa);
    printf("\nEnter the rate of interest: ");
    scanf("%f",&rt);
    printf("\nEnter the duration of time in Year: ");
    scanf("%d",&t);
    si = (pa * t * rt)/100;
    total = pa + si;
    printf("\nThe Interest Amount of Rs %f for %d years is: %f\n",pa,t,si);
    printf("\nThe Total Amount is %f + %f = %f",pa,si,total);
    printf("\n= = = = = = = = = = = = = = = = = = = = = = = = = = = = = = = = = = =\n\n");
}

Output:

= = = = = = = = =  = Simple Interest Calculation = = = = = = = = = =
Enter the principal amount: 500

Enter the rate of interest: 13.5

Enter the duration of time in Year: 5

The Interest Amount of Rs 500.000000 for 5 years is: 337.500000

The Total Amount is 500.000000 + 337.500000 = 837.500000
= = = = = = = = = = = = = = = = = = = = = = = = = = = = = = = = = = =

No comments:

Post a Comment