C program to calculate simple interest


       Simple interest is a method of calculating interest charged on fixed deposit
    Formula  i=(Ptr/100)
    Where i:Interese
               p:Principal
               t:time period
               r:rate of interest/year

    #include <stdio.h>
    int main()
    {
    int principal,time;
    float r,i;
    printf("input principal amount\n");
    scanf("%d",&principal);
    printf("input time (in year)\n");
    scanf("%d",&time);
    printf("input the rate of interest\n");
    scanf("%f",&r);
    i=(principal*time*r)/100;
    printf("Total interest %f\n",i);
    }

  OUTPUT:
     input principal amount
    10000
     input time (in year)
     4
     input the rate of interest
     7.5
     total interest 3000.000000



No comments:

Post a Comment

For any doubt or suggestion you can write here